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

* [Bug ipa/60072] wrong code (for code with an optimize attribute) at -O0 on x86_64-linux-gnu in 32-bit mode
  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 ` jakub at gcc dot gnu.org
  2014-02-05 15:31 ` su at cs dot ucdavis.edu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-05  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems to be a dup of PR60062.

*** This bug has been marked as a duplicate of bug 60062 ***


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

* [Bug ipa/60072] wrong code (for code with an optimize attribute) at -O0 on x86_64-linux-gnu in 32-bit mode
  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
  3 siblings, 0 replies; 5+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-05 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Jakub Jelinek from comment #1)
> Seems to be a dup of PR60062.
> 
> *** This bug has been marked as a duplicate of bug 60062 ***

Sorry for the dup Jakub, but are you certain about it?  Since 60062 also
affects 4.8.x, but this one doesn't, so I went and filed this report.


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

* [Bug ipa/60072] wrong code (for code with an optimize attribute) at -O0 on x86_64-linux-gnu in 32-bit mode
  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
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-05 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is fixed by the same patch, and is the same problem.  If one of the two PRs
ever worked with optimize attribute, it was purely by accident.


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

* [Bug ipa/60072] wrong code (for code with an optimize attribute) at -O0 on x86_64-linux-gnu in 32-bit mode
  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
                   ` (2 preceding siblings ...)
  2014-02-05 16:14 ` jakub at gcc dot gnu.org
@ 2014-02-05 20:37 ` su at cs dot ucdavis.edu
  3 siblings, 0 replies; 5+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-05 20:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Jakub Jelinek from comment #3)
> It is fixed by the same patch, and is the same problem.  If one of the two
> PRs ever worked with optimize attribute, it was purely by accident.

Okay, thanks Jakub!


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