public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997
@ 2004-09-23 21:45 schnetter at aei dot mpg dot de
  2004-09-23 21:46 ` [Bug c++/17642] " schnetter at aei dot mpg dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: schnetter at aei dot mpg dot de @ 2004-09-23 21:45 UTC (permalink / raw)
  To: gcc-bugs

I use 
 
$ /home/eschnett/gcc/bin/g++ --version 
g++ (GCC) 4.0.0 20040923 (experimental) 
 
I say 
 
/home/eschnett/gcc/bin/g++ -ftrapv -march=pentium4 -malign-double -g3 -Wall 
-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Woverloaded-virtual 
reduce.ii 
 
I get 
 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc: 
In function `T CarpetReduce::mysqrt(T) [with T = signed char]': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc:221: 
warning: converting to `signed char' from `double' 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc: 
In function `T CarpetReduce::mysqrt(T) [with T = short int]': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc:229: 
warning: converting to `short int' from `double' 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc: 
In function `T CarpetReduce::mysqrt(T) [with T = int]': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc:237: 
warning: converting to `int' from `double' 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc: 
In function `T CarpetReduce::mysqrt(T) [with T = long long int]': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc:245: 
warning: converting to `long long int' from `double' 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc: 
In function `void CarpetReduce::reduce(const int*, const int*, const int*, 
const std::vector<const void*, std::allocator<const void*> >&, const 
std::vector<double, std::allocator<double> >&, void*, void*, const double*, 
double)': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetReduce/src/reduce.cc:475: 
internal compiler error: in invert_truthvalue, at fold-const.c:2997

-- 
           Summary: internal compiler error: in invert_truthvalue, at fold-
                    const.c:2997
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schnetter at aei dot mpg dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/17642] internal compiler error: in invert_truthvalue, at fold-const.c:2997
  2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
@ 2004-09-23 21:46 ` schnetter at aei dot mpg dot de
  2004-09-23 22:02 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: schnetter at aei dot mpg dot de @ 2004-09-23 21:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schnetter at aei dot mpg dot de  2004-09-23 21:46 -------
Created an attachment (id=7208)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7208&action=view)
Failing preprocessed source code, gzipped


-- 


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


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

* [Bug c++/17642] internal compiler error: in invert_truthvalue, at fold-const.c:2997
  2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
  2004-09-23 21:46 ` [Bug c++/17642] " schnetter at aei dot mpg dot de
@ 2004-09-23 22:02 ` pinskia at gcc dot gnu dot org
  2004-09-23 22:27 ` [Bug c++/17642] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 22:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-23 22:02 -------
This is a front-end problem (or one where we forgot that COND_EXPR's first operand has to take a 
BOOLEAN_TYPE).

-- 


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


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

* [Bug c++/17642] [4.0 Regression] internal compiler error: in invert_truthvalue, at fold-const.c:2997
  2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
  2004-09-23 21:46 ` [Bug c++/17642] " schnetter at aei dot mpg dot de
  2004-09-23 22:02 ` pinskia at gcc dot gnu dot org
@ 2004-09-23 22:27 ` pinskia at gcc dot gnu dot org
  2004-09-24 23:24 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 22:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-23 22:27 -------
Here is the reduced testcase:
template<int dim>
int f(const int* const lsh, const int* const bbox, const int* const nghostzones, int d)
{
  for (int d=0; d<dim; ++d)
    lsh[d] - (bbox[2*d+1] ? 0 : nghostzones[d]);
}

This is definitely a bug in the front-end as the non-template version works correct.
: Search converges between 2004-05-20-trunk (#457) and 2004-05-23-trunk (#458).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-23 22:27:53
               date|                            |
            Summary|internal compiler error: in |[4.0 Regression] internal
                   |invert_truthvalue, at fold- |compiler error: in
                   |const.c:2997                |invert_truthvalue, at fold-
                   |                            |const.c:2997
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/17642] [4.0 Regression] internal compiler error: in invert_truthvalue, at fold-const.c:2997
  2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
                   ` (2 preceding siblings ...)
  2004-09-23 22:27 ` [Bug c++/17642] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-09-24 23:24 ` mmitchel at gcc dot gnu dot org
  2004-09-28  2:56 ` cvs-commit at gcc dot gnu dot org
  2004-09-28  3:05 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-09-24 23:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-09-24 23:24 -------
Andrew's analysis is overly simplistic.

During the initial parsing of templates, we build up trees which do not obey the
GCC tying rules to represent the users input.  At template-substitution time,
they are converted so that they do follow those rules.

Unfortunately, we sometimes call "fold" during the initial parsing phase from
build_binary_op.  It's not clear if this is necessary.  It is clearly that
constant-expressions (like "6 - 4") must be resolved at template parse time. 
The addition of the assert in fold is causing the compiler to crash.  It is
quite probable that if the compiler merely did not assert that by the time this
code was ever presented to the gimplifier all the types would be correct.

In the long run, we want to avoid calling "fold" at all, except on integral
constant-expressions.  In all other cases, we should just let the optimizers do
their thing.  That would make the front end both simpler and faster.  However,
that's not pratical for 4.0.

I will experiment with turning off the call to "fold" in build_binary_op, but I
suspect that we many need to remove the assert.

-- 


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


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

* [Bug c++/17642] [4.0 Regression] internal compiler error: in invert_truthvalue, at fold-const.c:2997
  2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
                   ` (3 preceding siblings ...)
  2004-09-24 23:24 ` mmitchel at gcc dot gnu dot org
@ 2004-09-28  2:56 ` cvs-commit at gcc dot gnu dot org
  2004-09-28  3:05 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-28  2:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-28 02:56 -------
Subject: Bug 17642

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-09-28 02:56:11

Modified files:
	gcc            : ChangeLog stor-layout.c tree.c 
	gcc/cp         : ChangeLog call.c cp-tree.h cvt.c decl.c pt.c 
	                 tree.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: crash23.C 

Log message:
	PR c++/17642
	* stor-layout.c (layout_decl): Use fold_convert, not convert.
	(bit_from_pos): Likewise.
	(byte_from_pos): Likewise.
	(pos_from_bit): Likewise.
	(normalize_offset): Likewise.
	(place_field): Likewise.
	(finalize_type_size): Likewise.
	(layout_type): Likewise.
	* tree.c (build_index_type): Likewise.
	
	PR c++/17642
	* cp-tree.h (fold_if_not_in_template): New function.
	* call.c (build_conditional_expr): Use fold_if_not_in_template.
	(build_cxx_call): Likewise.
	* cvt.c (convert_to_complex): Likewise.
	(ocp_convert): Likewise.
	(convert): Likewise.
	(convert_force): Likewise.
	* decl.c (compute_array_index_type): Clear
	processing_template_decl while folding array bounds.
	* pt.c (convert_nontype_argument): Clear
	processing_template_decl while processing non-type argument
	initialization.
	* tree.c (fold_if_not_in_template): New function.
	* typeck.c (build_class_member_access_expr): Use
	fold_if_not_in_template.
	(build_array_ref): Likewise.
	(build_binary_op): Likewise.  Do not try to optimize computations
	when processing templates.
	(cp_pointer_int_sum): Use fold_if_not_in_template.
	(pointer_diff): Likewise.
	(build_unary_op): Likewise.
	(build_reinterpret_cast): Likewise.
	(get_delta_difference): Likewise.
	(expand_ptrmemfunc_cst): Likewise.
	(dubious_conversion_warnings): Likewise.
	
	* g++.dg/template/crash23.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5650&r2=2.5651
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&r1=1.214&r2=1.215
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.435&r2=1.436
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4390&r2=1.4391
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.509&r2=1.510
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1054&r2=1.1055
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&r1=1.166&r2=1.167
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1305&r2=1.1306
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.927&r2=1.928
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.411&r2=1.412
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.578&r2=1.579
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4359&r2=1.4360
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash23.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/17642] [4.0 Regression] internal compiler error: in invert_truthvalue, at fold-const.c:2997
  2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
                   ` (4 preceding siblings ...)
  2004-09-28  2:56 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-28  3:05 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-09-28  3:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-09-28 03:05 -------
Fixed in GCC 4.0.

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


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


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

end of thread, other threads:[~2004-09-28  3:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 21:45 [Bug c++/17642] New: internal compiler error: in invert_truthvalue, at fold-const.c:2997 schnetter at aei dot mpg dot de
2004-09-23 21:46 ` [Bug c++/17642] " schnetter at aei dot mpg dot de
2004-09-23 22:02 ` pinskia at gcc dot gnu dot org
2004-09-23 22:27 ` [Bug c++/17642] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-09-24 23:24 ` mmitchel at gcc dot gnu dot org
2004-09-28  2:56 ` cvs-commit at gcc dot gnu dot org
2004-09-28  3:05 ` mmitchel 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).