public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc
@ 2005-04-14 13:32 drow at gcc dot gnu dot org
  2005-04-14 13:32 ` [Bug tree-optimization/21021] " drow at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: drow at gcc dot gnu dot org @ 2005-04-14 13:32 UTC (permalink / raw)
  To: gcc-bugs

cc1 options for the attached testcase are:
  -w -fpreprocessed dl-iteratephdr.i -quiet -O2 -std=gnu99

The ICE is:

dl-iteratephdr.c: In function '__dl_iterate_phdr':
dl-iteratephdr.c:36: internal compiler error: tree check: expected integer_type
or enumeral_type or boolean_type or char_type or real_type, have pointer_type in
compare_values, at tree-vrp.c:307
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

This is with a clean HEAD tree from half an hour ago, plus a workaround from bug
20126 (which is an RTL loop optimizer bug, so presumably irrelevant).

-- 
           Summary: ICE in tree-vrp building glibc
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: dnovillo at gcc dot gnu dot org
        ReportedBy: drow at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mips64-unknown-linux-gnu


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


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

* [Bug tree-optimization/21021] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
@ 2005-04-14 13:32 ` drow at gcc dot gnu dot org
  2005-04-14 13:38 ` kazu at cs dot umass dot edu
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: drow at gcc dot gnu dot org @ 2005-04-14 13:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From drow at gcc dot gnu dot org  2005-04-14 13:32 -------
Created an attachment (id=8630)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8630&action=view)
Test case


-- 


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


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

* [Bug tree-optimization/21021] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
  2005-04-14 13:32 ` [Bug tree-optimization/21021] " drow at gcc dot gnu dot org
@ 2005-04-14 13:38 ` kazu at cs dot umass dot edu
  2005-04-14 14:00 ` kazu at cs dot umass dot edu
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 13:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kazu at cs dot umass dot edu


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


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

* [Bug tree-optimization/21021] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
  2005-04-14 13:32 ` [Bug tree-optimization/21021] " drow at gcc dot gnu dot org
  2005-04-14 13:38 ` kazu at cs dot umass dot edu
@ 2005-04-14 14:00 ` kazu at cs dot umass dot edu
  2005-04-14 14:11 ` kazu at cs dot umass dot edu
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 14:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-14 14:00 -------
Daniel, I have tough time reproducing this.

I get

In file included from dl-iteratephdr.c:22:
../include/errno.h:31: error: thread-local storage not supported for this target

Am I missing some options?


-- 


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


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

* [Bug tree-optimization/21021] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-04-14 14:00 ` kazu at cs dot umass dot edu
@ 2005-04-14 14:11 ` kazu at cs dot umass dot edu
  2005-04-14 14:43 ` kazu at cs dot umass dot edu
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-14 14:11 -------
OK, I enabled HAVE_AS_TLS by hand.  Now I can reproduce the ICE.


-- 


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


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

* [Bug tree-optimization/21021] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-04-14 14:11 ` kazu at cs dot umass dot edu
@ 2005-04-14 14:43 ` kazu at cs dot umass dot edu
  2005-04-14 14:52 ` [Bug tree-optimization/21021] [4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 14:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-14 14:42 -------
Reduced down to:

struct link_map {
  struct link_map *next;
  unsigned int start, end;
};

void
foo (struct link_map **array, long int cnt)
{
  struct link_map *l;
  const void *caller = __builtin_extract_return_addr (__builtin_return_address (0));
  long int ns = 0;
  for (l = array[cnt]; l; l = l->next)
    {
      if (caller >= (const void *) l->start
	  && caller < (const void *) l->end)
	ns = cnt;
    }
  for (l = array[ns]; l != 0; l = l->next)
    ;
}


-- 


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-04-14 14:43 ` kazu at cs dot umass dot edu
@ 2005-04-14 14:52 ` pinskia at gcc dot gnu dot org
  2005-04-14 14:54 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-14 14:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-14 14:52 -------
Confirmed, with Kazu's reduced testcase on i686-pc-linux.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-14 14:52:15
               date|                            |
            Summary|ICE in tree-vrp building    |[4.1 Regression] ICE in
                   |glibc                       |tree-vrp building glibc
   Target Milestone|---                         |4.1.0


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-04-14 14:52 ` [Bug tree-optimization/21021] [4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-04-14 14:54 ` pinskia at gcc dot gnu dot org
  2005-04-14 14:56 ` kazu at cs dot umass dot edu
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-14 14:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-14 14:54 -------
Here is a testcase which does not use builtins:
struct link_map {
  struct link_map *next;
  unsigned int start, end;
};
void *f();

void
foo (struct link_map **array, long int cnt)
{
  struct link_map *l;
  const void *caller =f();
  long int ns = 0;
  for (l = array[cnt]; l; l = l->next)
    {
      if (caller >= (const void *) l->start
          && caller < (const void *) l->end)
        ns = cnt;
    }
  for (l = array[ns]; l != 0; l = l->next)
    ;
}

-- 


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-04-14 14:54 ` pinskia at gcc dot gnu dot org
@ 2005-04-14 14:56 ` kazu at cs dot umass dot edu
  2005-04-14 15:52 ` kazu at cs dot umass dot edu
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 14:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-14 14:56 -------
Reduced down to:

extern void *bar (void);

int
foo (unsigned int *p, unsigned int *q)
{
  const void *r = bar ();

  if (r >= (const void *) *p
      && r < (const void *) *q)
    return 1;

  return 0;
}


-- 


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-04-14 14:56 ` kazu at cs dot umass dot edu
@ 2005-04-14 15:52 ` kazu at cs dot umass dot edu
  2005-04-14 16:19 ` kazu at cs dot umass dot edu
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 15:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-14 15:51 -------
Before VRP (even before ASSERT_EXPR insertion), we have

  const void * r;
  unsigned int D.1157;
  void * D.1156;

  :
  :

  if (r_3 >= D.1157_5) goto <L0>; else goto <L5>;

Note that we already have a type-mismatched comparison - an integer
v.s. a pointer.

tree-vrp.c:maybe_add_assert_expr inserts the following ASSERT_EXPR in
the "else" branch of the "if" statement.

  r_14 = ASSERT_EXPR <r_3, r_3 < D.1157_5>;

Eventually the propagation engine visits this ASSERT_EXPR with a call
tree like so.

  simulate_stmt
    vrp_visit_stmt
      vrp_visit_assignment
        extract_range_from_expr
          extract_range_from_assert (ASSERT_EXPR <r_3, r_3 < D.1157_5>)
            value_ranges_intersect_p ([D.1156_2, D.1156_2], [0, D.1157_5 - 1])
              value_inside_range (D.1157_5 - 1, [D.1156_2, D.1156_2])
                compare_values (D.1157_5 - 1, D.1156_2)

compare_values does some limited symbolic comparisons.  In this case,
it checks whether D.1156_2 == INF so that if that's the case, we can
deduce that

  D.1157_5 - 1 < D.1156_2

But we cannot compute TYPE_MAX_VALUE (TREE_TYPE (D.1156_2)) because
D.1156_2 is of a pointer type, causing the ICE.

The root cause of the problem is that we have a type-mismatched
comparison.


-- 


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-04-14 15:52 ` kazu at cs dot umass dot edu
@ 2005-04-14 16:19 ` kazu at cs dot umass dot edu
  2005-04-14 23:07 ` kazu at cs dot umass dot edu
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 16:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |21024


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-04-14 16:19 ` kazu at cs dot umass dot edu
@ 2005-04-14 23:07 ` kazu at cs dot umass dot edu
  2005-04-15  1:29 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-14 23:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-14 23:07 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01668.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org
         AssignedTo|dnovillo at gcc dot gnu dot |kazu at cs dot umass dot edu
                   |org                         |
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2005-04-14 23:07 ` kazu at cs dot umass dot edu
@ 2005-04-15  1:29 ` cvs-commit at gcc dot gnu dot org
  2005-04-15  1:31 ` kazu at cs dot umass dot edu
  2005-04-17  1:41 ` kazu at cs dot umass dot edu
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-15  1:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-15 01:29 -------
Subject: Bug 21021

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kazu@gcc.gnu.org	2005-04-15 01:29:44

Modified files:
	gcc            : ChangeLog tree-vrp.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/compile: pr21021.c 

Log message:
	gcc/
	PR tree-optimization/21021
	* tree-vrp.c (compare_values): Work around a bug in the front
	end that produces a comparison of mismatched types.
	
	testsuite/
	PR tree-optimization/21021
	* gcc.c-torture/compile/pr21021.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8297&r2=2.8298
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-vrp.c.diff?cvsroot=gcc&r1=2.7&r2=2.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5350&r2=1.5351
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr21021.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2005-04-15  1:29 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-15  1:31 ` kazu at cs dot umass dot edu
  2005-04-17  1:41 ` kazu at cs dot umass dot edu
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-15  1:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-04-15 01:31 -------
Just checked in a workaround patch.
For a real fix, keep an eye on PR 21024.


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


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


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

* [Bug tree-optimization/21021] [4.1 Regression] ICE in tree-vrp building glibc
  2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2005-04-15  1:31 ` kazu at cs dot umass dot edu
@ 2005-04-17  1:41 ` kazu at cs dot umass dot edu
  13 siblings, 0 replies; 15+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-17  1:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 21021 depends on bug 21024, which changed state.

Bug 21024 Summary: fold generates a comparison of two operands whose types do not match
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21024

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

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


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

end of thread, other threads:[~2005-04-17  1:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-14 13:32 [Bug tree-optimization/21021] New: ICE in tree-vrp building glibc drow at gcc dot gnu dot org
2005-04-14 13:32 ` [Bug tree-optimization/21021] " drow at gcc dot gnu dot org
2005-04-14 13:38 ` kazu at cs dot umass dot edu
2005-04-14 14:00 ` kazu at cs dot umass dot edu
2005-04-14 14:11 ` kazu at cs dot umass dot edu
2005-04-14 14:43 ` kazu at cs dot umass dot edu
2005-04-14 14:52 ` [Bug tree-optimization/21021] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-04-14 14:54 ` pinskia at gcc dot gnu dot org
2005-04-14 14:56 ` kazu at cs dot umass dot edu
2005-04-14 15:52 ` kazu at cs dot umass dot edu
2005-04-14 16:19 ` kazu at cs dot umass dot edu
2005-04-14 23:07 ` kazu at cs dot umass dot edu
2005-04-15  1:29 ` cvs-commit at gcc dot gnu dot org
2005-04-15  1:31 ` kazu at cs dot umass dot edu
2005-04-17  1:41 ` kazu at cs dot umass dot 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).