public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/16721] New: Accesses to volatile objects optimized away with -fno-strict-aliasing Date: Mon, 26 Jul 2004 18:12:00 -0000 [thread overview] Message-ID: <20040726181156.16721.macro@linux-mips.org> (raw) Certain read accesses to objects marked as "volatile" are optimized away. This happens when both "-O2" and "-fno-strict-aliasing" are specified. This has been observed with the Linux kernel which is unusable in certain configurations due to this problem. This used to work with 3.4.0. Environment: System: Linux macro 2.4.26 #3 Thu May 6 20:57:18 CEST 2004 i686 unknown unknown GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: mips64el-unknown-linux-gnu configured with: ../configure --prefix=/usr --enable-languages=c --disable-libmudflap --disable-shared --target=mips64el-linux How-To-Repeat: The following program can be used: $ cat volatile.c struct data { volatile unsigned long *addr; } *p; int test() { *p->addr; return 0; } $ mips64el-linux-gcc -mabi=32 -O2 -fno-strict-aliasing -mno-abicalls -S volatile.c -o volatile.s $ cat volatile.s .file 1 "volatile.c" .section .mdebug.abi32 .previous .text .align 2 .align 2 .globl test .ent test .type test, @function test: .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro j $31 move $2,$0 .set macro .set reorder .end test .comm p,4,4 .ident "GCC: (GNU) 3.5.0 20040726 (experimental)" After removing the "-fno-strict-aliasing" option, the output is correct: $ mips64el-linux-gcc -mabi=32 -O2 -mno-abicalls -S volatile.c -o volatile.s $ cat volatile.s .file 1 "volatile.c" .section .mdebug.abi32 .previous .text .align 2 .align 2 .globl test .ent test .type test, @function test: .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro lui $2,%hi(p) lw $4,%lo(p)($2) move $2,$0 lw $3,0($4) nop lw $5,0($3) j $31 nop .set macro .set reorder .end test .comm p,4,4 .ident "GCC: (GNU) 3.5.0 20040726 (experimental)" ------- Additional Comments From macro at linux-mips dot org 2004-07-26 18:11 ------- Fix: None known. Using "-fstrict-aliasing" may be a workaround, but it is not an option for Linux. -- Summary: Accesses to volatile objects optimized away with -fno- strict-aliasing Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: macro at linux-mips dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: mips64el-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16721
next reply other threads:[~2004-07-26 18:12 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-07-26 18:12 gcc-bugzilla at gcc dot gnu dot org [this message] 2004-07-26 19:04 ` [Bug c/16721] [3.5 Regression] Accesses to volatile objects optimized away falk at debian dot org 2004-07-26 19:24 ` pinskia at gcc dot gnu dot org 2004-07-26 19:30 ` falk at debian dot org 2004-07-27 12:25 ` macro at linux-mips dot org 2004-07-27 12:50 ` macro at linux-mips dot org 2004-07-27 14:48 ` falk at debian dot org 2004-07-29 2:33 ` [Bug tree-optimization/16721] " pinskia at gcc dot gnu dot org 2004-07-29 11:27 ` macro at linux-mips dot org 2004-08-03 5:58 ` pinskia at gcc dot gnu dot org 2004-09-19 13:57 ` [Bug tree-optimization/16721] [4.0 " steven at gcc dot gnu dot org 2004-09-19 15:42 ` bangerth at dealii dot org 2004-09-22 14:41 ` dnovillo at gcc dot gnu dot org 2004-09-22 16:14 ` dnovillo at gcc dot gnu dot org 2004-09-22 16:26 ` stevenb at suse dot de 2004-09-22 16:41 ` dnovillo at redhat dot com 2004-09-22 17:23 ` dnovillo at gcc dot gnu dot org 2004-09-22 17:23 ` dnovillo at gcc dot gnu dot org 2004-09-22 23:33 ` cvs-commit at gcc dot gnu dot org 2004-09-22 23:36 ` dnovillo at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040726181156.16721.macro@linux-mips.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).