public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
@ 2005-08-29 15:13 cnewbold at mathworks dot com
  2005-08-29 15:34 ` [Bug c++/23624] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: cnewbold at mathworks dot com @ 2005-08-29 15:13 UTC (permalink / raw)
  To: gcc-bugs

Attempting to compile the following example (with no explicit command-line
arguments) results in an ICE:

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

typedef unsigned char RESET_OCCUR_DT;    

typedef struct {
    RESET_OCCUR_DT*        pResetOccur;
} DintgRec;

template<typename T>
void f()
{
    int i, resetScalar;
    DintgRec* s;

    if (s->pResetOccur[resetScalar ? 0 : i] != 0U) {
    }
}


void g()
{
    f<int>();
}

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

Here's the exact compiler output:

ice.C: In function `void f()':
ice.C:13: internal compiler error: in invert_truthvalue, at fold-const.c:2697
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
cnewbold@sarge:~/playpen$

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

And here's the output of '-v' on the compiler in question:

Reading specs from
/mathworks/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: /home/cnewbold/src/gnu/gcc-3.4.4/configure
--enable-__cxa_atexit --prefix=/hub/Linux/glibc-2.3.2/i686/apps/gcc-3.4.4
Thread model: posix
gcc version 3.4.4

-- 
           Summary: ICE: internal compiler error: in invert_truthvalue, at
                    fold-const.c:2697
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cnewbold at mathworks dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
@ 2005-08-29 15:34 ` pinskia at gcc dot gnu dot org
  2005-08-29 15:36 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-29 15:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |3.4.0 4.0.0 4.1.0
      Known to work|                            |3.3.3
            Summary|ICE: internal compiler      |[3.4/4.0/4.1 Regression]
                   |error: in invert_truthvalue,|ICE: internal compiler
                   |at fold-const.c:2697        |error: in invert_truthvalue,
                   |                            |at fold-const.c:2697
   Target Milestone|---                         |4.0.2


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
  2005-08-29 15:34 ` [Bug c++/23624] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-08-29 15:36 ` pinskia at gcc dot gnu dot org
  2005-08-30  8:23 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-29 15:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-29 15:35 -------
Reduced testcase:
template<int>
void f()
{
    int *t, i;
    t[i ? 0 : i];
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-29 15:35:43
               date|                            |


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
  2005-08-29 15:34 ` [Bug c++/23624] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-08-29 15:36 ` pinskia at gcc dot gnu dot org
@ 2005-08-30  8:23 ` rguenth at gcc dot gnu dot org
  2005-08-30  9:13 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-30  8:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-30 08:17 -------
Looking into it

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-08-29 15:35:43         |2005-08-30 08:17:22
               date|                            |


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (2 preceding siblings ...)
  2005-08-30  8:23 ` rguenth at gcc dot gnu dot org
@ 2005-08-30  9:13 ` rguenth at gcc dot gnu dot org
  2005-08-30 10:12 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-30  9:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-30 08:58 -------
It's weird we only fail with f being a template function.  In fact, only in this
case we reach the point where we try the invalid folding.

Nevertheless, I have an (obvious) patch.  Testing in progress.

-- 


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (3 preceding siblings ...)
  2005-08-30  9:13 ` rguenth at gcc dot gnu dot org
@ 2005-08-30 10:12 ` rguenth at gcc dot gnu dot org
  2005-08-30 10:31 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-30 10:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-30 09:42 -------
While my patch is to the middle-end, the C++ frontend part causing this is

build_x_conditional_expr
...
  expr = build_conditional_expr (ifexp, op1, op2);
  if (processing_template_decl && expr != error_mark_node)
    return build_min_non_dep (COND_EXPR, expr,
                              orig_ifexp, orig_op1, orig_op2);

where in the case of a template decl, the valid expr i != 0 ? 0 : i is
thrown away and rebuilt as i ? 0 : i, where the default conversion is no
longer applied.  That could be fixed using perform_implicit_conversion
(boolean_type_node, orig_ifexp) - but I don't know if that would succeed
in case of i being a template param.  We use this (potentially dependent)
expr later to create a non-dependent expr where we fail to apply the
default conversion, too, in

pt.c:build_non_dependent_expr

we could fix that there, too, performing default conversion if the type
is not correct.  And later in

typeck.c:build_array_ref

we happen to call fold on the invalid(?) COND_EXPR.

Of course I'm a lot less confident on the C++ fix than on the fold one.

-- 


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (4 preceding siblings ...)
  2005-08-30 10:12 ` rguenth at gcc dot gnu dot org
@ 2005-08-30 10:31 ` rguenth at gcc dot gnu dot org
  2005-09-09  9:01 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-30 10:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-30 10:26 -------
Patches:
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01739.html
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01740.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (5 preceding siblings ...)
  2005-08-30 10:31 ` rguenth at gcc dot gnu dot org
@ 2005-09-09  9:01 ` cvs-commit at gcc dot gnu dot org
  2005-09-09  9:26 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-09  9:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-09-09 09:01 -------
Subject: Bug 23624

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rguenth@gcc.gnu.org	2005-09-09 09:00:42

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/tree-ssa: pr23624.C 

Log message:
	2005-09-09  Richard Guenther  <rguenther@suse.de>
	
	PR c++/23624
	* fold-const.c (fold_ternary): Check truth_value_p before
	calling invert_truthvalue.
	
	* g++.dg/tree-ssa/pr23624.C: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9923&r2=2.9924
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.624&r2=1.625
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6039&r2=1.6040
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/tree-ssa/pr23624.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (6 preceding siblings ...)
  2005-09-09  9:01 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-09  9:26 ` cvs-commit at gcc dot gnu dot org
  2005-09-09 10:21 ` cvs-commit at gcc dot gnu dot org
  2005-09-09 10:21 ` rguenth at gcc dot gnu dot org
  9 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-09  9:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-09-09 09:25 -------
Subject: Bug 23624

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	rguenth@gcc.gnu.org	2005-09-09 09:25:25

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/tree-ssa: pr23624.C 

Log message:
	2005-09-09  Richard Guenther  <rguenther@suse.de>
	
	PR c++/23624
	* fold-const.c (fold): Check truth_value_p before calling
	invert_truthvalue.
	
	* g++.dg/tree-ssa/pr23624.C: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.421&r2=2.7592.2.422
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.517.2.15&r2=1.517.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.395&r2=1.5084.2.396
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/tree-ssa/pr23624.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (8 preceding siblings ...)
  2005-09-09 10:21 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-09 10:21 ` rguenth at gcc dot gnu dot org
  9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-09-09 10:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-09-09 10:20 -------
Fixed everywhere.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.2                       |3.4.5


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
  2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
                   ` (7 preceding siblings ...)
  2005-09-09  9:26 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-09 10:21 ` cvs-commit at gcc dot gnu dot org
  2005-09-09 10:21 ` rguenth at gcc dot gnu dot org
  9 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-09 10:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-09-09 10:21 -------
Subject: Bug 23624

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rguenth@gcc.gnu.org	2005-09-09 10:20:03

Modified files:
	gcc            : ChangeLog fold-const.c 

Log message:
	2005-09-09  Richard Guenther  <rguenther@suse.de>
	
	PR c++/23624
	* fold-const.c (fold): Check truth_value_p before calling
	invert_truthvalue.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.915&r2=2.2326.2.916
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.322.2.18&r2=1.322.2.19



-- 


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


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

* [Bug c++/23624] [3.4/4.0/4.1 Regression] ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697
       [not found] <bug-23624-10855@http.gcc.gnu.org/bugzilla/>
@ 2006-08-11 21:06 ` patchapp at dberlin dot org
  0 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2006-08-11 21:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from patchapp at dberlin dot org  2006-08-11 21:06 -------
Subject: Bug number PR23624

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2005-08/msg01740.html


-- 


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


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

end of thread, other threads:[~2006-08-11 21:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-29 15:13 [Bug c++/23624] New: ICE: internal compiler error: in invert_truthvalue, at fold-const.c:2697 cnewbold at mathworks dot com
2005-08-29 15:34 ` [Bug c++/23624] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-08-29 15:36 ` pinskia at gcc dot gnu dot org
2005-08-30  8:23 ` rguenth at gcc dot gnu dot org
2005-08-30  9:13 ` rguenth at gcc dot gnu dot org
2005-08-30 10:12 ` rguenth at gcc dot gnu dot org
2005-08-30 10:31 ` rguenth at gcc dot gnu dot org
2005-09-09  9:01 ` cvs-commit at gcc dot gnu dot org
2005-09-09  9:26 ` cvs-commit at gcc dot gnu dot org
2005-09-09 10:21 ` cvs-commit at gcc dot gnu dot org
2005-09-09 10:21 ` rguenth at gcc dot gnu dot org
     [not found] <bug-23624-10855@http.gcc.gnu.org/bugzilla/>
2006-08-11 21:06 ` patchapp at dberlin 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).