public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class
@ 2014-04-29 12:32 D.Bahadir at GMX dot de
  2014-04-29 13:46 ` [Bug c++/60999] [4.9/4.10 " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: D.Bahadir at GMX dot de @ 2014-04-29 12:32 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 7335 bytes --]

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

            Bug ID: 60999
           Summary: [4.9 Regression] ICE when static_cast from constexpr
                    in specialization of template-class
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: D.Bahadir at GMX dot de

Created attachment 32705
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32705&action=edit
source which can reproduce the ICE

The following code produces an internal compiler error (ICE) in GCC 4.9, but
did compile fine in GCC 4.8:

<code>

  // general template
  template <typename A>
  struct foo
  {
  };

  // template specialization
  template<>
  struct foo<int>
  {
      static constexpr int code = 42;
      unsigned int bar = static_cast<unsigned int>(code);
      // ICE at static_cast during instantiation. --^
  };

  // instantiation
  foo<int> a;

</code>

Compiling with the following line (using GCC 4.9) reproduced the ICE:
  g++ -Wall -Wextra -std=c++11 -c ICE.cpp


The output of 'g++ -v -save-temps -Wall -Wextra -std=c++11 -c ICE.cpp' yields
the following information:


Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.9-20140406-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.0 20140405 (experimental) [trunk revision 209157] (Ubuntu
4.9-20140406-1ubuntu1) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-std=c++11' '-c'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.9/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE ICE.cpp -mtune=generic -march=x86-64 -std=c++11
-Wall -Wextra -fpch-preprocess -fstack-protector -Wformat -Wformat-security -o
ICE.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.9"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.9
 /usr/include/x86_64-linux-gnu/c++/4.9
 /usr/include/c++/4.9/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.9/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-std=c++11' '-c'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.9/cc1plus -fpreprocessed ICE.ii -quiet
-dumpbase ICE.cpp -mtune=generic -march=x86-64 -auxbase ICE -Wall -Wextra
-std=c++11 -version -fstack-protector -Wformat -Wformat-security -o ICE.s
GNU C++ (Ubuntu 4.9-20140406-1ubuntu1) version 4.9.0 20140405 (experimental)
[trunk revision 209157] (x86_64-linux-gnu)
    compiled by GNU C version 4.9.0 20140405 (experimental) [trunk revision
209157], GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu 4.9-20140406-1ubuntu1) version 4.9.0 20140405 (experimental)
[trunk revision 209157] (x86_64-linux-gnu)
    compiled by GNU C version 4.9.0 20140405 (experimental) [trunk revision
209157], GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 6752b609dd6385b31002233d89fe2356
ICE.cpp:17:10:   in constexpr expansion of ‘a.foo<int>::foo()’
ICE.cpp:17:10: internal compiler error: unexpected expression
‘static_cast<unsigned int>(foo<int>::code)’ of kind static_cast_expr
 foo<int> a;
          ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cc5DJH1d.out file, please attach this to
your bugreport.
>From gcc-bugs-return-450114-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 29 12:36:35 2014
Return-Path: <gcc-bugs-return-450114-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2385 invoked by alias); 29 Apr 2014 12:36:34 -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 2181 invoked by uid 48); 29 Apr 2014 12:36:31 -0000
From: "D.Bahadir at GMX dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60999] [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class
Date: Tue, 29 Apr 2014 12:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: D.Bahadir at GMX dot de
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: attachments.created
Message-ID: <bug-60999-4-C7mcM0C7lt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60999-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60999-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: 2014-04/txt/msg02134.txt.bz2
Content-length: 274

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`999

--- Comment #1 from Deniz Bahadir <D.Bahadir at GMX dot de> ---
Created attachment 32706
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2706&actioníit
preprocessed source generated by GCC with option '-save-temps'


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
@ 2014-04-29 13:46 ` rguenth at gcc dot gnu.org
  2014-04-29 18:06 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-29 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-04-29
      Known to work|                            |4.8.2
   Target Milestone|---                         |4.9.1
            Summary|[4.9 Regression] ICE when   |[4.9/4.10 Regression] ICE
                   |static_cast from constexpr  |when static_cast from
                   |in specialization of        |constexpr in specialization
                   |template-class              |of template-class
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.0

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
  2014-04-29 13:46 ` [Bug c++/60999] [4.9/4.10 " rguenth at gcc dot gnu.org
@ 2014-04-29 18:06 ` jakub at gcc dot gnu.org
  2014-04-30  0:05 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-29 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |paolo at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r204818.


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
  2014-04-29 13:46 ` [Bug c++/60999] [4.9/4.10 " rguenth at gcc dot gnu.org
  2014-04-29 18:06 ` jakub at gcc dot gnu.org
@ 2014-04-30  0:05 ` paolo.carlini at oracle dot com
  2014-05-06 22:33 ` paolo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-04-30  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|D.Bahadir at GMX dot de            |
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm finishing testing this, appears to work fine so far:

Index: pt.c
===================================================================
--- pt.c    (revision 209916)
+++ pt.c    (working copy)
@@ -463,6 +463,7 @@ maybe_begin_member_template_processing (tree decl)

   if (nsdmi)
     decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
+        && uses_template_parms (DECL_CONTEXT (decl))
         ? CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (decl))
         : NULL_TREE);


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
                   ` (2 preceding siblings ...)
  2014-04-30  0:05 ` paolo.carlini at oracle dot com
@ 2014-05-06 22:33 ` paolo at gcc dot gnu.org
  2014-05-06 22:34 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-06 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue May  6 22:32:49 2014
New Revision: 210126

URL: http://gcc.gnu.org/viewcvs?rev=210126&root=gcc&view=rev
Log:
/cp
2014-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60999
    * pt.c (maybe_begin_member_template_processing): Use
    uses_template_parms.

/testsuite
2014-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60999
    * g++.dg/cpp0x/nsdmi-template9.C: New.
    * g++.dg/cpp0x/nsdmi-template10.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template10.C
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
                   ` (3 preceding siblings ...)
  2014-05-06 22:33 ` paolo at gcc dot gnu.org
@ 2014-05-06 22:34 ` paolo at gcc dot gnu.org
  2014-05-06 22:36 ` paolo.carlini at oracle dot com
  2014-05-07  7:24 ` paolo at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-06 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue May  6 22:34:11 2014
New Revision: 210127

URL: http://gcc.gnu.org/viewcvs?rev=210127&root=gcc&view=rev
Log:
/cp
2014-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60999
    * pt.c (maybe_begin_member_template_processing): Use
    uses_template_parms.

/testsuite
2014-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60999
    * g++.dg/cpp0x/nsdmi-template9.C: New.
    * g++.dg/cpp0x/nsdmi-template10.C: Likewise.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/nsdmi-template10.C
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/nsdmi-template9.C
Modified:
    branches/gcc-4_9-branch/gcc/cp/ChangeLog
    branches/gcc-4_9-branch/gcc/cp/pt.c


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
                   ` (4 preceding siblings ...)
  2014-05-06 22:34 ` paolo at gcc dot gnu.org
@ 2014-05-06 22:36 ` paolo.carlini at oracle dot com
  2014-05-07  7:24 ` paolo at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-06 22:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|jason at gcc dot gnu.org,          |
                   |paolo at gcc dot gnu.org           |
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed mainline and 4.9.1.


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

* [Bug c++/60999] [4.9/4.10 Regression] ICE when static_cast from constexpr in specialization of template-class
  2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
                   ` (5 preceding siblings ...)
  2014-05-06 22:36 ` paolo.carlini at oracle dot com
@ 2014-05-07  7:24 ` paolo at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-07  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed May  7 07:24:21 2014
New Revision: 210140

URL: http://gcc.gnu.org/viewcvs?rev=210140&root=gcc&view=rev
Log:
/cp
2014-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60999
    * pt.c (maybe_begin_member_template_processing): Use
    uses_template_parms.

/testsuite
2014-05-06  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60999
    * g++.dg/cpp0x/nsdmi-template9.C: New.
    * g++.dg/cpp0x/nsdmi-template10.C: Likewise.

Modified:
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-05-07  7:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-29 12:32 [Bug c++/60999] New: [4.9 Regression] ICE when static_cast from constexpr in specialization of template-class D.Bahadir at GMX dot de
2014-04-29 13:46 ` [Bug c++/60999] [4.9/4.10 " rguenth at gcc dot gnu.org
2014-04-29 18:06 ` jakub at gcc dot gnu.org
2014-04-30  0:05 ` paolo.carlini at oracle dot com
2014-05-06 22:33 ` paolo at gcc dot gnu.org
2014-05-06 22:34 ` paolo at gcc dot gnu.org
2014-05-06 22:36 ` paolo.carlini at oracle dot com
2014-05-07  7:24 ` paolo at gcc dot gnu.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).