public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22278] New: gcc -O2 discards cast to volatile
@ 2005-07-02 16:43 olivier dot baudron at m4x dot org
  2005-07-02 16:48 ` [Bug c/22278] " pinskia at gcc dot gnu dot org
                   ` (50 more replies)
  0 siblings, 51 replies; 57+ messages in thread
From: olivier dot baudron at m4x dot org @ 2005-07-02 16:43 UTC (permalink / raw)
  To: gcc-bugs

In the following testcase, a read memory access should be made.
However gcc -O2 optimizes away the code inside the test function.

------------------- test.c --------------------
void test (char *addr) {
        *((volatile char *) addr);
}
-----------------------------------------------

$ gcc -Wall -O2 -S test.c

------------------- test.s --------------------
test.s:
        .file   "test.c"
        .text
        .p2align 4,,15
.globl test
        .type   test, @function
test:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        ret
        .size   test, .-test
        .ident  "GCC: (GNU) 4.1.0 20050702 (experimental)"
        .section        .note.GNU-stack,"",@progbits
-----------------------------------------------

-- 
           Summary: gcc -O2 discards cast to volatile
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: olivier dot baudron at m4x dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22278


^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2005-08-11 23:56 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-02 16:43 [Bug c/22278] New: gcc -O2 discards cast to volatile olivier dot baudron at m4x dot org
2005-07-02 16:48 ` [Bug c/22278] " pinskia at gcc dot gnu dot org
2005-07-02 22:08   ` Gabriel Dos Reis
2005-07-02 16:59 ` olivier dot baudron at m4x dot org
2005-07-02 17:03 ` pinskia at gcc dot gnu dot org
2005-07-02 17:33 ` falk at debian dot org
2005-07-02 17:42 ` pinskia at gcc dot gnu dot org
2005-07-02 17:53 ` falk at debian dot org
2005-07-02 20:38 ` falk at debian dot org
2005-07-02 22:07 ` gcc2eran at tromer dot org
2005-07-02 22:08 ` gdr at integrable-solutions dot net
2005-07-02 22:10 ` gdr at integrable-solutions dot net
2005-07-02 22:10 ` gdr at integrable-solutions dot net
2005-07-02 22:11 ` gdr at integrable-solutions dot net
2005-07-02 22:12 ` gdr at integrable-solutions dot net
2005-07-02 22:19 ` falk at debian dot org
2005-07-02 22:20 ` pinskia at gcc dot gnu dot org
2005-07-02 22:20 ` gdr at integrable-solutions dot net
2005-07-02 22:39 ` gdr at integrable-solutions dot net
2005-07-02 22:49 ` pinskia at gcc dot gnu dot org
2005-07-02 23:30 ` gcc2eran at tromer dot org
2005-07-03  0:03   ` Gabriel Dos Reis
2005-07-02 23:45 ` falk at debian dot org
2005-07-02 23:54 ` gdr at integrable-solutions dot net
2005-07-03  0:03 ` gdr at integrable-solutions dot net
2005-07-03  1:19 ` gcc2eran at tromer dot org
2005-07-03  1:27 ` joseph at codesourcery dot com
2005-07-03  1:42 ` gdr at integrable-solutions dot net
2005-07-03  1:43 ` gdr at integrable-solutions dot net
2005-07-03  1:47 ` gcc2eran at tromer dot org
2005-07-03  1:54 ` hugh at mimosa dot com
2005-07-03  2:30 ` gcc2eran at tromer dot org
2005-07-03  2:54 ` gdr at integrable-solutions dot net
2005-07-03  4:14 ` gcc2eran at tromer dot org
2005-07-03  4:43   ` Gabriel Dos Reis
2005-07-03  4:43 ` gdr at integrable-solutions dot net
2005-07-03  5:11   ` Gabriel Dos Reis
2005-07-03  5:09 ` gcc2eran at tromer dot org
2005-07-03  5:11 ` gdr at integrable-solutions dot net
2005-07-03  5:18 ` gdr at integrable-solutions dot net
2005-07-03  5:40 ` hugh at mimosa dot com
2005-07-03  6:59 ` gcc2eran at tromer dot org
2005-07-03  7:09 ` schlie at comcast dot net
2005-07-03  7:27 ` gdr at integrable-solutions dot net
2005-07-03  7:54 ` schlie at comcast dot net
2005-07-05  2:17 ` james at juranfamily dot org
2005-07-15  6:41 ` neroden at gcc dot gnu dot org
2005-07-15  7:52   ` Gabriel Dos Reis
2005-07-15  8:10 ` gdr at integrable-solutions dot net
2005-07-16 16:35 ` hugh at mimosa dot com
2005-07-16 17:53 ` gdr at integrable-solutions dot net
2005-07-17  8:09 ` hugh at mimosa dot com
2005-07-17 16:59 ` rth at gcc dot gnu dot org
2005-07-19 20:28 ` [Bug tree-optimization/22278] " cvs-commit at gcc dot gnu dot org
2005-07-20  0:11 ` cvs-commit at gcc dot gnu dot org
2005-07-20  0:26 ` rth at gcc dot gnu dot org
2005-08-11 23:56 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).