public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/60072] New: wrong code (for code with an optimize attribute) at -O0 on x86_64-linux-gnu in 32-bit mode
@ 2014-02-05  8:55 su at cs dot ucdavis.edu
  2014-02-05  9:17 ` [Bug ipa/60072] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-05  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60072
           Summary: wrong code (for code with an optimize attribute) at
                    -O0 on x86_64-linux-gnu in 32-bit mode
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk (as well as all earlier versions from 4.6.x to 4.8.x)
miscompiles the following code with an optimize attribute on x86_64-linux at
-O0 in 32-bit mode (but not 64-bit). 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20140204 (experimental) [trunk revision 207486] (GCC) 
$ 
$ gcc-trunk -m32 -O1 small.c; a.out
$ gcc-trunk -m64 -O0 small.c; a.out
$ 
$ gcc-trunk -m32 -O0 small.c; a.out
Segmentation fault (core dumped)
$ gcc-4.8.2 -m32 -O0 small.c; a.out
Segmentation fault (core dumped)
$ gcc-4.7.3 -m32 -O0 small.c; a.out
Segmentation fault (core dumped)
$ gcc-4.6.4 -m32 -O0 small.c; a.out
Segmentation fault (core dumped)
$ 


-----------------------------------


int i, *a = &i, **b = &a, c, d, **e = &a; 

__attribute__ ((optimize (1)))
static int *foo (int *p)
{
  *e = p;
  return 0;
}

int
main ()
{
  foo (&c);
  d < 1 && **b;
  return 0;
}


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

end of thread, other threads:[~2014-02-05 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-05  8:55 [Bug ipa/60072] New: wrong code (for code with an optimize attribute) at -O0 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
2014-02-05  9:17 ` [Bug ipa/60072] " jakub at gcc dot gnu.org
2014-02-05 15:31 ` su at cs dot ucdavis.edu
2014-02-05 16:14 ` jakub at gcc dot gnu.org
2014-02-05 20:37 ` su at cs dot ucdavis.edu

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).