public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58827] ICE in cxx_eval_constant_expression
  2013-10-21 16:58 [Bug c++/58827] New: ICE in cxx_eval_constant_expression rmansfield at qnx dot com
@ 2013-10-21 16:58 ` rmansfield at qnx dot com
  2013-10-21 18:25 ` nschellenberger at qnx dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rmansfield at qnx dot com @ 2013-10-21 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ryan Mansfield <rmansfield at qnx dot com> ---
Created attachment 31063
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31063&action=edit
2nd preprocessed src


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

* [Bug c++/58827] New: ICE in cxx_eval_constant_expression
@ 2013-10-21 16:58 rmansfield at qnx dot com
  2013-10-21 16:58 ` [Bug c++/58827] " rmansfield at qnx dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rmansfield at qnx dot com @ 2013-10-21 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58827
           Summary: ICE in cxx_eval_constant_expression
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rmansfield at qnx dot com

Created attachment 31062
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31062&action=edit
preprocessed src

Two testcases reproduce the ICE in cxx_eval_constant_expression on gcc 4.8 and
4.9 (including fix for 58466)

$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --disable-bootstrap --enable-languages=c++
--enable-checking=yes
Thread model: posix
gcc version 4.9.0 20131021 (experimental) [trunk revision 203899] (GCC) 

$ ./xg++ -B. -std=c++11 ~/ice.ii
/home/ryan/ice.ii: In function ‘void f(int)’:
/home/ryan/ice.ii:1:80: internal compiler error: unexpected expression
‘static_cast<unsigned int>(x)’ of kind static_cast_expr
 template <typename T> void f(int x) { const unsigned
y{static_cast<unsigned>(x)}; }
                                                                               
^
0x6cdfa5 cxx_eval_constant_expression
    ../../gcc/cp/semantics.c:9660
0x6d0f76 cxx_eval_outermost_constant_expr
    ../../gcc/cp/semantics.c:9680
0x6d3c2b maybe_constant_value(tree_node*)
    ../../gcc/cp/semantics.c:9790
0x5ddf8d check_narrowing(tree_node*, tree_node*)
    ../../gcc/cp/typeck2.c:842
0x55568f check_initializer
    ../../gcc/cp/decl.c:5669
0x568686 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
    ../../gcc/cp/decl.c:6253
0x655a56 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16640
0x65731e cp_parser_simple_declaration
    ../../gcc/cp/parser.c:11054
0x63add0 cp_parser_block_declaration
    ../../gcc/cp/parser.c:10935
0x63be90 cp_parser_declaration_statement
    ../../gcc/cp/parser.c:10582
0x63c547 cp_parser_statement
    ../../gcc/cp/parser.c:9333
0x63d7fe cp_parser_statement_seq_opt
    ../../gcc/cp/parser.c:9611
0x63d946 cp_parser_compound_statement
    ../../gcc/cp/parser.c:9565
0x650f83 cp_parser_function_body
    ../../gcc/cp/parser.c:18408
0x650f83 cp_parser_ctor_initializer_opt_and_function_body
    ../../gcc/cp/parser.c:18444
0x65530f cp_parser_function_definition_after_declarator
    ../../gcc/cp/parser.c:22452
0x656063 cp_parser_function_definition_from_specifiers_and_declarator
    ../../gcc/cp/parser.c:22373
0x656063 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16419
0x656444 cp_parser_single_declaration
    ../../gcc/cp/parser.c:22766
0x656750 cp_parser_template_declaration_after_export
    ../../gcc/cp/parser.c:22568
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


$ ./xg++ -B. -std=c++11 ~/ice2.ii
/home/ryan/ice2.ii: In function ‘void f(int)’:
/home/ryan/ice2.ii:3:56: internal compiler error: unexpected expression ‘g’ of
kind overload
 template <typename T> void f(int x) { const int a {g(x)}; }
                                                        ^
0x6cdfa5 cxx_eval_constant_expression
    ../../gcc/cp/semantics.c:9660
0x6cc7a6 cxx_eval_call_expression
    ../../gcc/cp/semantics.c:8244
0x6cdeef cxx_eval_constant_expression
    ../../gcc/cp/semantics.c:9367
0x6d0f76 cxx_eval_outermost_constant_expr
    ../../gcc/cp/semantics.c:9680
0x6d3c2b maybe_constant_value(tree_node*)
    ../../gcc/cp/semantics.c:9790
0x5ddf8d check_narrowing(tree_node*, tree_node*)
    ../../gcc/cp/typeck2.c:842
0x55568f check_initializer
    ../../gcc/cp/decl.c:5669
0x568686 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
    ../../gcc/cp/decl.c:6253
0x655a56 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16640
0x65731e cp_parser_simple_declaration
    ../../gcc/cp/parser.c:11054
0x63add0 cp_parser_block_declaration
    ../../gcc/cp/parser.c:10935
0x63be90 cp_parser_declaration_statement
    ../../gcc/cp/parser.c:10582
0x63c547 cp_parser_statement
    ../../gcc/cp/parser.c:9333
0x63d7fe cp_parser_statement_seq_opt
    ../../gcc/cp/parser.c:9611
0x63d946 cp_parser_compound_statement
    ../../gcc/cp/parser.c:9565
0x650f83 cp_parser_function_body
    ../../gcc/cp/parser.c:18408
0x650f83 cp_parser_ctor_initializer_opt_and_function_body
    ../../gcc/cp/parser.c:18444
0x65530f cp_parser_function_definition_after_declarator
    ../../gcc/cp/parser.c:22452
0x656063 cp_parser_function_definition_from_specifiers_and_declarator
    ../../gcc/cp/parser.c:22373
0x656063 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16419
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
>From gcc-bugs-return-432379-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Oct 21 17:01:54 2013
Return-Path: <gcc-bugs-return-432379-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9037 invoked by alias); 21 Oct 2013 17:01:54 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 8995 invoked by uid 48); 21 Oct 2013 17:01:50 -0000
From: "bugzilla@poradnik-webmastera.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/58828] New: Problem compiling gcc 4.8.2 using gcc 4.4.6
Date: Mon, 21 Oct 2013 17:01:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: bugzilla@poradnik-webmastera.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58828-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01523.txt.bz2
Content-length: 2906

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX828

            Bug ID: 58828
           Summary: Problem compiling gcc 4.8.2 using gcc 4.4.6
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugzilla@poradnik-webmastera.com

I am trying to build gcc 4.8.2, and I got following compilation error:

make[3]: Entering directory `[path]/gcc/obj/gcc'

g++ -g -fkeep-inline-functions -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -o
build/genconstants \ build/genconstants.o build/read-md.o build/errors.o
../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a

build/genconstants ../../gcc-4.8.2/gcc/config/i386/i386.md \
           > tmp-constants.h
/bin/sh ../../gcc-4.8.2/gcc/../move-if-change tmp-constants.h insn-constants.h
echo timestamp > s-constants

g++ -g -fkeep-inline-functions -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -o
build/gengtype \ build/gengtype.o build/errors.o build/gengtype-lex.o
build/gengtype-parse.o build/gengtype-state.o build/version.o
../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a

build/gengtype.o: In function `double_int::operator*=(double_int)':

[path]/gcc/obj/gcc/../../gcc-4.8.2/gcc/double-int.h:263: undefined reference to
`double_int::operator*(double_int) const'

build/gengtype.o: In function `double_int::operator+=(double_int)':

[path]/gcc/obj/gcc/../../gcc-4.8.2/gcc/double-int.h:270: undefined reference to
`double_int::operator+(double_int) const'

build/gengtype.o: In function `double_int::operator-=(double_int)':

[path]/gcc/obj/gcc/../../gcc-4.8.2/gcc/double-int.h:277: undefined reference to
`double_int::operator-(double_int) const'

collect2: ld returned 1 exit status
make[3]: *** [build/gengtype] Error 1
make[3]: Leaving directory `[path]/gcc/obj/gcc'

gcc is configured this way:

../gcc-4.8.2/configure --prefix=[myprefix] --enable-languages=c,c++
--disable-nls


I compile with sources for all needed tools and libs unpacked into gcc dir.
Here are versions:

binutils-2.23.2.tar.bz2
cloog-0.18.0.tar.gz
gcc-4.8.2.tar.bz2
gmp-5.1.3.tar.bz2
isl-0.11.1.tar.bz2
mpc-1.0.1.tar.gz
mpfr-3.1.2.tar.bz2

gcc --version
gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


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

* [Bug c++/58827] ICE in cxx_eval_constant_expression
  2013-10-21 16:58 [Bug c++/58827] New: ICE in cxx_eval_constant_expression rmansfield at qnx dot com
  2013-10-21 16:58 ` [Bug c++/58827] " rmansfield at qnx dot com
@ 2013-10-21 18:25 ` nschellenberger at qnx dot com
  2013-10-21 18:40 ` paolo.carlini at oracle dot com
  2014-03-17 15:38 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: nschellenberger at qnx dot com @ 2013-10-21 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

Neil Schellenberger <nschellenberger at qnx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nschellenberger at qnx dot com

--- Comment #2 from Neil Schellenberger <nschellenberger at qnx dot com> ---
For what it's worth, the salient pre-conditions appear to be:

  - function template definition (or class template method definition and
probably also method template definition)
  - implementation contains a const of integral type
  - initialization via brace-init-list
  - initializer-clause containing either a cast (operator or notation); or an
overloaded function (and possibly others?)

Changing any of those seems to avoid the ICE.


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

* [Bug c++/58827] ICE in cxx_eval_constant_expression
  2013-10-21 16:58 [Bug c++/58827] New: ICE in cxx_eval_constant_expression rmansfield at qnx dot com
  2013-10-21 16:58 ` [Bug c++/58827] " rmansfield at qnx dot com
  2013-10-21 18:25 ` nschellenberger at qnx dot com
@ 2013-10-21 18:40 ` paolo.carlini at oracle dot com
  2014-03-17 15:38 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-21 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-21
                 CC|                            |paolo.carlini at oracle dot com
     Ever confirmed|0                           |1


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

* [Bug c++/58827] ICE in cxx_eval_constant_expression
  2013-10-21 16:58 [Bug c++/58827] New: ICE in cxx_eval_constant_expression rmansfield at qnx dot com
                   ` (2 preceding siblings ...)
  2013-10-21 18:40 ` paolo.carlini at oracle dot com
@ 2014-03-17 15:38 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-03-17 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |DUPLICATE
   Target Milestone|---                         |4.9.0

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0 as well.

*** This bug has been marked as a duplicate of bug 59571 ***


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

end of thread, other threads:[~2014-03-17 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21 16:58 [Bug c++/58827] New: ICE in cxx_eval_constant_expression rmansfield at qnx dot com
2013-10-21 16:58 ` [Bug c++/58827] " rmansfield at qnx dot com
2013-10-21 18:25 ` nschellenberger at qnx dot com
2013-10-21 18:40 ` paolo.carlini at oracle dot com
2014-03-17 15:38 ` paolo.carlini at oracle 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).