public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/60062] New: wrong code (for code with the optimize attribute) at -O1 and above on x86_64-linux-gnu in 32-bit mode
@ 2014-02-04 19:13 su at cs dot ucdavis.edu
  2014-02-04 19:25 ` [Bug ipa/60062] [4.7/4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-04 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60062
           Summary: wrong code (for code with the optimize attribute) at
                    -O1 and above 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 miscompiles the following code that uses the optimize
attribute on x86_64-linux at -O1 and above in 32-bit mode (but not 64-bit). 

This is a regression from 4.8.x.

It also affects 4.7.x and 4.6.x. 

$ 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 207452] (GCC) 
$ 
$ gcc-trunk -m32 -O0 small.c; a.out
hello
$ gcc-trunk -m64 -O1 small.c; a.out
hello
$ gcc-4.8 -m32 -O1 small.c; a.out
hello
$
$ gcc-trunk -m32 -O1 small.c; a.out
Segmentation fault (core dumped) 
$ gcc-4.7 -m32 -O1 small.c; a.out
Segmentation fault (core dumped)
$ gcc-4.6 -m32 -O1 small.c; a.out
Segmentation fault (core dumped)
$ 


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


int printf(const char *, ...);

int a;

static void 
foo(const char *p1, int p2) 
{ 
  printf("%s\n", p1); 
}

__attribute__((optimize(0))) 
int 
main() 
{
  foo("hello", a);
  return 0;
}


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

end of thread, other threads:[~2021-08-30  1:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-04 19:13 [Bug ipa/60062] New: wrong code (for code with the optimize attribute) at -O1 and above on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
2014-02-04 19:25 ` [Bug ipa/60062] [4.7/4.9 Regression] " mpolacek at gcc dot gnu.org
2014-02-05  8:23 ` [Bug target/60062] " jakub at gcc dot gnu.org
2014-02-05  9:17 ` jakub at gcc dot gnu.org
2014-02-05 15:43 ` su at cs dot ucdavis.edu
2014-02-06 10:54 ` jakub at gcc dot gnu.org
2014-02-10  9:41 ` [Bug target/60062] [4.7/4.8 " rguenth at gcc dot gnu.org
2014-02-10  9:42 ` rguenth at gcc dot gnu.org
2014-03-06  7:57 ` jakub at gcc dot gnu.org
2014-04-18  7:32 ` [Bug target/60062] [4.7 " jakub at gcc dot gnu.org
2014-06-12 13:34 ` rguenth at gcc dot gnu.org
2021-08-08 22:22 ` pinskia at gcc dot gnu.org
2021-08-30  1:36 ` pinskia at gcc dot gnu.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).