public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/36917]  New: [4.3 regression] miscompilation with -O2 and r136501
@ 2008-07-24  9:05 doko at ubuntu dot com
  2008-07-24  9:05 ` [Bug tree-optimization/36917] " doko at ubuntu dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:05 UTC (permalink / raw)
  To: gcc-bugs

OpenJDK (using the IcedTea6 build and patches) fails to build with 4.3 from the
4.3 branch, when the jvm built in stage1 is used for the first time in the
stage2 build:

-def-pcompile:
    [javac] Compiling 2 source files to
/scratch/packages/openjdk/x/openjdk-6-6b11/openjdk/control/build/linux-i586/langtools/build/toolclasses
WARNING: Default charset US-ASCII not supported, using ISO-8859-1 instead
    [javac]
/scratch/packages/openjdk/x/openjdk-6-6b11/openjdk/langtools/make/tools/CompileProperties/CompileProperties.java:26:
cannot access unnamed package
    [javac] ANSI_X3.4-1968
    [javac] import java.io.BufferedWriter;
    [javac] ^

BUILD FAILED

the build failure is not seen when reverting r136501; seen as well when just
reverting the two hunks for record_numbers_of_iterations.

seen with -O3 and -O2, not -O1.

not seen on amd64 and sparc (the other two archs using OpenJDK hotspot).

the miscompiled file is ciTypeFlow.cpp, compiled using
g++-4.3 -fpic -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -g -m32
-march=i586 -mtune=generic -O2 -fno-strict-aliasing -DVM_LITTLE_ENDIAN 
-Wpointer-arith -Wconversion -Wsign-compare -c ciTypeFlow.cpp


-- 
           Summary: [4.3 regression] miscompilation with -O2 and r136501
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: doko at ubuntu dot com
GCC target triplet: i486-linux-gnu


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
@ 2008-07-24  9:05 ` doko at ubuntu dot com
  2008-07-24  9:06 ` doko at ubuntu dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from doko at ubuntu dot com  2008-07-24 09:05 -------
Created an attachment (id=15948)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15948&action=view)
preprocessed source


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
  2008-07-24  9:05 ` [Bug tree-optimization/36917] " doko at ubuntu dot com
@ 2008-07-24  9:06 ` doko at ubuntu dot com
  2008-07-24  9:07 ` doko at ubuntu dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from doko at ubuntu dot com  2008-07-24 09:06 -------
Created an attachment (id=15949)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15949&action=view)
tree dump (r136501 reverted)


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
  2008-07-24  9:05 ` [Bug tree-optimization/36917] " doko at ubuntu dot com
  2008-07-24  9:06 ` doko at ubuntu dot com
@ 2008-07-24  9:07 ` doko at ubuntu dot com
  2008-07-24  9:07 ` doko at ubuntu dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from doko at ubuntu dot com  2008-07-24 09:06 -------
Created an attachment (id=15950)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15950&action=view)
tree dump (r136501)


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (2 preceding siblings ...)
  2008-07-24  9:07 ` doko at ubuntu dot com
@ 2008-07-24  9:07 ` doko at ubuntu dot com
  2008-07-24  9:16 ` doko at ubuntu dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from doko at ubuntu dot com  2008-07-24 09:07 -------
Created an attachment (id=15951)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15951&action=view)
diff of tree dump


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (3 preceding siblings ...)
  2008-07-24  9:07 ` doko at ubuntu dot com
@ 2008-07-24  9:16 ` doko at ubuntu dot com
  2008-07-24  9:28 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from doko at ubuntu dot com  2008-07-24 09:15 -------
-O3 and -fwrapv, r136501 not reverted works


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (4 preceding siblings ...)
  2008-07-24  9:16 ` doko at ubuntu dot com
@ 2008-07-24  9:28 ` pinskia at gcc dot gnu dot org
  2008-07-24  9:32 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-24  9:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-07-24 09:27 -------
if -fwrapv works then is really a bug?  Yes overflow is defined in java but c++
is not java. 


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (6 preceding siblings ...)
  2008-07-24  9:32 ` rguenth at gcc dot gnu dot org
@ 2008-07-24  9:32 ` doko at ubuntu dot com
  2008-07-24  9:52 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-24  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from doko at ubuntu dot com  2008-07-24 09:31 -------
Created an attachment (id=15952)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15952&action=view)
preprocessed source (no pch used)


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (5 preceding siblings ...)
  2008-07-24  9:28 ` pinskia at gcc dot gnu dot org
@ 2008-07-24  9:32 ` rguenth at gcc dot gnu dot org
  2008-07-24  9:32 ` doko at ubuntu dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-07-24  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2008-07-24 09:31 -------
Looking at the source I don't see any integer overflows - the fact that
-fno-ivopts makes it work and the effect is on a variable introduced by
ivopts hints at a GCC bug more than a application bug.

So - now I cannot put the state back to UNCONFIRMED. :P


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-07-24 09:31:51
               date|                            |


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (7 preceding siblings ...)
  2008-07-24  9:32 ` doko at ubuntu dot com
@ 2008-07-24  9:52 ` rguenth at gcc dot gnu dot org
  2008-07-25 12:14 ` rguenth at gcc dot gnu dot org
  2008-07-25 13:55 ` doko at ubuntu dot com
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-07-24  9:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2008-07-24 09:52 -------
The difference comes from the second VRP pass which concludes that c_76 is
[1, +INF] from which it changes

# c_173 = PHI <0(7), c_76(12)>

to

# c_173 = PHI <0(7), 1(12)>

which it concludes from

c_76 = (Cell) D.156138_4;

where Cell is

  enum Cell {
    Cell_0
  };

so the only valid values for c_76 are 0 and 1.  The problem is probably here
(c is of type Cell):

  D.156112_62 = c_173 * 4;

(D.156112 is unsigned int), where we obviously miss a cast in the IL.

This is from inlining ciTypeFlow::StateVector::type_at which looks like

ciType* ciTypeFlow::StateVector::type_at(ciTypeFlow::Cell) const (this, c)
{
  struct ciType * D.144073;
  struct ciType * * D.144074;
  unsigned int D.144075;
  struct ciType * * D.144076;

  D.144074 = this->_types;
  D.144075 = c * 4;
  D.144076 = D.144074 + D.144075;
  D.144073 = *D.144076;
  return D.144073;
}

gimplified from

return <retval> = *((struct ciType * *) ((const struct StateVector *)
this)->_types + (unsigned int) ((unsigned int) c * 4));

which hints at that c probably has the same precision and signedness as
unsigned int.


-- 


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (8 preceding siblings ...)
  2008-07-24  9:52 ` rguenth at gcc dot gnu dot org
@ 2008-07-25 12:14 ` rguenth at gcc dot gnu dot org
  2008-07-25 13:55 ` doko at ubuntu dot com
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-07-25 12:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-07-25 12:14 -------
I belive this is just INVALID.  The code seems to do lots of things with
this enum Cell, but the C++ compiler is allowed to just allocate 1 bit of
storage for it.

Maybe changing the Cell declaration to

enum Cell { Cell_0, Cell_max = UINT_MAX }

fixes the issue.

See 7.2/6 for the standard wording.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug tree-optimization/36917] [4.3 regression] miscompilation with -O2 and r136501
  2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
                   ` (9 preceding siblings ...)
  2008-07-25 12:14 ` rguenth at gcc dot gnu dot org
@ 2008-07-25 13:55 ` doko at ubuntu dot com
  10 siblings, 0 replies; 12+ messages in thread
From: doko at ubuntu dot com @ 2008-07-25 13:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from doko at ubuntu dot com  2008-07-25 13:54 -------
the suggested change fixes the OpenJDK build.


-- 


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


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

end of thread, other threads:[~2008-07-25 13:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24  9:05 [Bug tree-optimization/36917] New: [4.3 regression] miscompilation with -O2 and r136501 doko at ubuntu dot com
2008-07-24  9:05 ` [Bug tree-optimization/36917] " doko at ubuntu dot com
2008-07-24  9:06 ` doko at ubuntu dot com
2008-07-24  9:07 ` doko at ubuntu dot com
2008-07-24  9:07 ` doko at ubuntu dot com
2008-07-24  9:16 ` doko at ubuntu dot com
2008-07-24  9:28 ` pinskia at gcc dot gnu dot org
2008-07-24  9:32 ` rguenth at gcc dot gnu dot org
2008-07-24  9:32 ` doko at ubuntu dot com
2008-07-24  9:52 ` rguenth at gcc dot gnu dot org
2008-07-25 12:14 ` rguenth at gcc dot gnu dot org
2008-07-25 13:55 ` doko at ubuntu dot com

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