public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/34029]  New: internal compiler error: verify_stmts failed
@ 2007-11-08 13:40 holger dot hopp at sap dot com
  2007-11-08 13:41 ` [Bug tree-optimization/34029] " holger dot hopp at sap dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: holger dot hopp at sap dot com @ 2007-11-08 13:40 UTC (permalink / raw)
  To: gcc-bugs

I discovered following internal compiler error in gcc 4.3.0 (trunk).
The cause is the svn change 125925.

The title sounds to be similar to bug 34018, but the removal of change
125925 does not help for bug 34018. So this bug must be something
different.

gcc version:  gcc 4.3.0 svn revision 125925 and later
at least with gcc 4.3.0 svn revision 129958 (20071107).

$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=...my_path... --enable-shared
--with-gmp=...my_path... --with-mpfr=...my_path... --enable-languages=c,c++
Thread model: posix
gcc version 4.3.0 20071107 (experimental) (GCC)

steps to reproduce:

$ gcc -O2 -c testcase.c
testcase.c: In function 'checkVersionLibtestcase':
testcase.c:10: error: invalid array index
20 - (<unnamed-signed:64>) &version_testcase;

testcase.c:10: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Exit 1

Without optimization it compiles fine:
$ gcc -c testcase.c

Commenting out change 125925 also compiles fine (patch attached).


-- 
           Summary: internal compiler error: verify_stmts failed
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: holger dot hopp at sap dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug tree-optimization/34029] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
@ 2007-11-08 13:41 ` holger dot hopp at sap dot com
  2007-11-08 18:21 ` [Bug tree-optimization/34029] [4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: holger dot hopp at sap dot com @ 2007-11-08 13:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from holger dot hopp at sap dot com  2007-11-08 13:41 -------
Created an attachment (id=14508)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14508&action=view)
reproducer


-- 


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
  2007-11-08 13:41 ` [Bug tree-optimization/34029] " holger dot hopp at sap dot com
@ 2007-11-08 18:21 ` pinskia at gcc dot gnu dot org
  2007-11-08 20:27 ` jakub at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-08 18:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Keywords|                            |ice-on-valid-code
            Summary|internal compiler error:    |[4.3 Regression] internal
                   |verify_stmts failed         |compiler error: verify_stmts
                   |                            |failed
   Target Milestone|---                         |4.3.0


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
  2007-11-08 13:41 ` [Bug tree-optimization/34029] " holger dot hopp at sap dot com
  2007-11-08 18:21 ` [Bug tree-optimization/34029] [4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2007-11-08 20:27 ` jakub at gcc dot gnu dot org
  2007-11-10 22:25 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-08 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-11-08 20:27 -------
Slightly reduced:
static const char s[] = "ab.cd.efghijk";

int
foo (const char *x)
{
  const char *a;
  int b = 0;

  a = __builtin_strchr (s, '.');
  if (a == 0)
    b = 1;
  else if ((a = __builtin_strchr (a + 1, '.')) == 0)
    b = 1;
  else if (__builtin_strncmp (s, x, a - s))
    b = 1;
  else if (__builtin_strncmp (a + 1, x + (a - s + 1), 4) < 0)
    b = 1;

  if (b)
    return 4;
  return 0;
}


-- 


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (2 preceding siblings ...)
  2007-11-08 20:27 ` jakub at gcc dot gnu dot org
@ 2007-11-10 22:25 ` pinskia at gcc dot gnu dot org
  2007-11-10 22:26 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-10 22:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-11-10 22:25 -------
Hmm:
D.1532_19: [&s[6 - (<unnamed-signed:32>) &s], &s[6 - (<unnamed-signed:32>) &s]]


I think this my fault with respect of pointer plus merge. taking over.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-10 22:25:22
               date|                            |


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (3 preceding siblings ...)
  2007-11-10 22:25 ` pinskia at gcc dot gnu dot org
@ 2007-11-10 22:26 ` pinskia at gcc dot gnu dot org
  2007-11-20 11:50 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-10 22:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-11-10 22:26 -------
  D.1533_20 = (long unsigned int) &s[6 - (<unnamed-signed:32>) &s];

should really folded to just 6.


-- 


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (4 preceding siblings ...)
  2007-11-10 22:26 ` pinskia at gcc dot gnu dot org
@ 2007-11-20 11:50 ` jakub at gcc dot gnu dot org
  2007-11-27 22:17 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-20 11:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2007-11-20 11:50 -------
While it would be nice if that got folded, I believe the problem is elsewhere.
Consider:
static const char s[] = "ab.cd.efghijk";
static const char t[] = "abcde";

long
foo (const char *x)
{
  const char *a;
  long b = 0;

  a = __builtin_strchr (s, '.');
  return ((long) a) + (1 - (long) t);
}


(ok, not really kosher code, because there are two unrelated pointers
involved).

This ICEs the same way, and really fold can't fold &s[2] p+ (1 - (long int)
&t[0]) to anything meaningful (well, perhaps it could avoid creating the
ADDR_EXPR.

The problem is IMHO in is_gimple_min_invariant blindly allowing any ADDR_EXPRs
with TREE_INVARIANT set, yet the checking code in verify_expr insists that also
TREE_OPERAND (addr_ref, 1) is is_gimple_val.
Either the checking code should be made less stricter and allow any
TREE_INVARIANT ADDR_EXPRs (likely very bad idea), or is_gimple_min_invariant
should enforce it:
    case ADDR_EXPR:
      return TREE_INVARIANT (t) && is_gimple_val (TREE_OPERAND (t, 1));


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com,
                   |                            |dnovillo at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (5 preceding siblings ...)
  2007-11-20 11:50 ` jakub at gcc dot gnu dot org
@ 2007-11-27 22:17 ` mmitchel at gcc dot gnu dot org
  2008-01-03 16:49 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-11-27 22:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (6 preceding siblings ...)
  2007-11-27 22:17 ` mmitchel at gcc dot gnu dot org
@ 2008-01-03 16:49 ` rguenth at gcc dot gnu dot org
  2008-01-03 17:03 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-03 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-01-03 16:23 -------
I will test the following

bool
is_gimple_min_invariant (const_tree t)
{
  switch (TREE_CODE (t))
    {
    case ADDR_EXPR:
      /* We do not allow arbitrary invariant expressions as gimple
         such as &a[1 - &b], but only allow constant array indices
         inside the otherwise TREE_INVARIANT expression.  */
      if (!TREE_INVARIANT (t))
        return false;
      t = TREE_OPERAND (t, 0);
      while (handled_component_p (t))
        {
          if ((TREE_CODE (t) == ARRAY_REF
               || TREE_CODE (t) == ARRAY_RANGE_REF)
              && TREE_CODE (TREE_OPERAND (t, 1)) != INTEGER_CST)
            return false;
          t = TREE_OPERAND (t, 0);
        }
      return true;


-- 


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (7 preceding siblings ...)
  2008-01-03 16:49 ` rguenth at gcc dot gnu dot org
@ 2008-01-03 17:03 ` pinskia at gcc dot gnu dot org
  2008-01-04 13:49 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-03 17:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2008-01-03 16:23 -------
I don't have time to work on this any more.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (8 preceding siblings ...)
  2008-01-03 17:03 ` pinskia at gcc dot gnu dot org
@ 2008-01-04 13:49 ` rguenth at gcc dot gnu dot org
  2008-01-04 13:51 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 13:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2008-01-04 13:32 -------
Mine.  We'll stop the verifier from complaining.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-11-10 22:25:22         |2008-01-04 13:32:46
               date|                            |


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (9 preceding siblings ...)
  2008-01-04 13:49 ` rguenth at gcc dot gnu dot org
@ 2008-01-04 13:51 ` rguenth at gcc dot gnu dot org
  2008-01-04 16:04 ` rguenth at gcc dot gnu dot org
  2008-01-04 16:12 ` rguenth at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 13:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2008-01-04 13:33 -------
Which also means this is a checking-only ICE.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (10 preceding siblings ...)
  2008-01-04 13:51 ` rguenth at gcc dot gnu dot org
@ 2008-01-04 16:04 ` rguenth at gcc dot gnu dot org
  2008-01-04 16:12 ` rguenth at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 16:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-01-04 15:57 -------
Subject: Bug 34029

Author: rguenth
Date: Fri Jan  4 15:56:41 2008
New Revision: 131325

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131325
Log:
2008-01-04  Richard Guenther  <rguenther@suse.de>

        PR middle-end/34029
        * tree-cfg.c (verify_expr): Do not look inside ADDR_EXPRs
        for verifying purposes if they are is_gimple_min_invariant.

        * gcc.c-torture/compile/pr34029-1.c: New testcase.
        * gcc.c-torture/compile/pr34029-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr34029-1.c
    trunk/gcc/testsuite/gcc.c-torture/compile/pr34029-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-cfg.c


-- 


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


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

* [Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
  2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
                   ` (11 preceding siblings ...)
  2008-01-04 16:04 ` rguenth at gcc dot gnu dot org
@ 2008-01-04 16:12 ` rguenth at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-04 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2008-01-04 15:59 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-01-04 16:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 13:40 [Bug tree-optimization/34029] New: internal compiler error: verify_stmts failed holger dot hopp at sap dot com
2007-11-08 13:41 ` [Bug tree-optimization/34029] " holger dot hopp at sap dot com
2007-11-08 18:21 ` [Bug tree-optimization/34029] [4.3 Regression] " pinskia at gcc dot gnu dot org
2007-11-08 20:27 ` jakub at gcc dot gnu dot org
2007-11-10 22:25 ` pinskia at gcc dot gnu dot org
2007-11-10 22:26 ` pinskia at gcc dot gnu dot org
2007-11-20 11:50 ` jakub at gcc dot gnu dot org
2007-11-27 22:17 ` mmitchel at gcc dot gnu dot org
2008-01-03 16:49 ` rguenth at gcc dot gnu dot org
2008-01-03 17:03 ` pinskia at gcc dot gnu dot org
2008-01-04 13:49 ` rguenth at gcc dot gnu dot org
2008-01-04 13:51 ` rguenth at gcc dot gnu dot org
2008-01-04 16:04 ` rguenth at gcc dot gnu dot org
2008-01-04 16:12 ` rguenth at gcc dot gnu dot 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).