public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error
@ 2013-01-04 19:40 npl at chello dot at
  2013-01-07 16:59 ` [Bug c++/55879] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: npl at chello dot at @ 2013-01-04 19:40 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55879
           Summary: [C++11][constexpr] nested constexpr Initialisation
                    raises internal compiler error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: npl@chello.at


Created attachment 29084
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29084
code to raise the error

Compiling the added code results in an internal compiler error, I tested this
with GCC 4.6.3 and 4.7.2, both fail at different lines though. Some notes:
for 4.7.2:
*) I tested using a defaulted copy-constructor, this fixes the issue
*) removing the constexpr fixes the issue
for 4.6.3:
*) I havent tested the provided code itself (have no access to 4.6.3 right
now), I used slightly bigger version of the code. Im hopefull it still causes
trouble.
*) the important part is to use an external variable but have an additional
entry in the array with an constant

I dint provide a preprocessed source because I hope this is a sufficiently
small piece to reproduce the error easily. Since this seems a rather fragile
issue right now I guess it would be a good idea to create some bigger tests and
check other gcc versions aswell - thats the reason I have code to break both
versions in one file instead of simplifying it further.

---------------Command used (4.7.2/4.6.3 respectively):
g++ -std=c++11 nestedconstexpr.cpp
g++ -std=c++09 nestedconstexpr.cpp
---------------Compiler version:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-4'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586
--with-tune=generic --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-4)


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

* [Bug c++/55879] [C++11][constexpr] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
@ 2013-01-07 16:59 ` paolo.carlini at oracle dot com
  2013-01-07 23:25 ` [Bug c++/55879] [C++11] " daniel.kruegler at googlemail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-07 16:59 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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

* [Bug c++/55879] [C++11] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
  2013-01-07 16:59 ` [Bug c++/55879] " paolo.carlini at oracle dot com
@ 2013-01-07 23:25 ` daniel.kruegler at googlemail dot com
  2013-01-08 19:31 ` npl at chello dot at
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-01-07 23:25 UTC (permalink / raw)
  To: gcc-bugs


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-01-07 23:25:12 UTC ---
The problem also occurs for gcc 4.8.0 20121209 (experimental). Let me remark
that according to C++11 the variable s_Memmap could not be used in constant
expressions, because it contains an (effective) reinterpret_cast, which is not
allowed in this context.


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

* [Bug c++/55879] [C++11] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
  2013-01-07 16:59 ` [Bug c++/55879] " paolo.carlini at oracle dot com
  2013-01-07 23:25 ` [Bug c++/55879] [C++11] " daniel.kruegler at googlemail dot com
@ 2013-01-08 19:31 ` npl at chello dot at
  2013-01-08 20:26 ` daniel.kruegler at googlemail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: npl at chello dot at @ 2013-01-08 19:31 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from npl at chello dot at 2013-01-08 19:30:29 UTC ---
(In reply to comment #1)
> The problem also occurs for gcc 4.8.0 20121209 (experimental). Let me remark
> that according to C++11 the variable s_Memmap could not be used in constant
> expressions, because it contains an (effective) reinterpret_cast, which is not
> allowed in this context.

If I understand you right, then you mean that the s_Memmap is not an
"constexpr" array. As far as I understand this is not an issue that schould
prevent compiling - I believe constexpr arrays are valid and different to const
arrays? The former should not compile with this initializer.
Also this variable is an linkervariable in my project, and I dont think gcc
could "constexpr" it... even if I might be able to do away with the cast with
something like
extern "C" const unsigned _lnkDDRRAM[];

btw here is my error output for 4.7.2:
nestedconstexpr.cpp:35:1:   in constexpr expansion of
‘CNested(CAddress(1107296256u))’
nestedconstexpr.cpp:22:26:   in constexpr expansion of
‘((CNested*)this)->CNested::m_PrimaryBlock.CAddress::CAddress((* & primary))’
nestedconstexpr.cpp:35:1: internal compiler error: in cxx_eval_indirect_ref, at
cp/semantics.c:7435


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

* [Bug c++/55879] [C++11] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
                   ` (2 preceding siblings ...)
  2013-01-08 19:31 ` npl at chello dot at
@ 2013-01-08 20:26 ` daniel.kruegler at googlemail dot com
  2013-02-13 17:57 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-01-08 20:26 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-01-08 20:26:33 UTC ---
(In reply to comment #2)
> If I understand you right, then you mean that the s_Memmap is not an
> "constexpr" array. As far as I understand this is not an issue that schould
> prevent compiling - I believe constexpr arrays are valid and different to const
> arrays?

Yes, this would not be an issue here. I'm only mentioning it, because your
issue was titled "nested constexpr initialization" which is actually incorrect.


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

* [Bug c++/55879] [C++11] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
                   ` (3 preceding siblings ...)
  2013-01-08 20:26 ` daniel.kruegler at googlemail dot com
@ 2013-02-13 17:57 ` jason at gcc dot gnu.org
  2013-02-13 18:05 ` jason at gcc dot gnu.org
  2013-02-15 19:32 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-13 17:57 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-13 17:56:44 UTC ---
Author: jason
Date: Wed Feb 13 17:56:38 2013
New Revision: 196024

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196024
Log:
    PR c++/55879
    * semantics.c (cxx_bind_parameters_in_call): Undo DECL_BY_REFERENCE.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-invisiref1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c


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

* [Bug c++/55879] [C++11] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
                   ` (4 preceding siblings ...)
  2013-02-13 17:57 ` jason at gcc dot gnu.org
@ 2013-02-13 18:05 ` jason at gcc dot gnu.org
  2013-02-15 19:32 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-13 18:05 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-02-13
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-13 18:04:40 UTC ---
Fixed in 4.8 for now.


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

* [Bug c++/55879] [C++11] nested constexpr Initialisation raises internal compiler error
  2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
                   ` (5 preceding siblings ...)
  2013-02-13 18:05 ` jason at gcc dot gnu.org
@ 2013-02-15 19:32 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-15 19:32 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-15 19:31:53 UTC ---
And closing.


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

end of thread, other threads:[~2013-02-15 19:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-04 19:40 [Bug c++/55879] New: [C++11][constexpr] nested constexpr Initialisation raises internal compiler error npl at chello dot at
2013-01-07 16:59 ` [Bug c++/55879] " paolo.carlini at oracle dot com
2013-01-07 23:25 ` [Bug c++/55879] [C++11] " daniel.kruegler at googlemail dot com
2013-01-08 19:31 ` npl at chello dot at
2013-01-08 20:26 ` daniel.kruegler at googlemail dot com
2013-02-13 17:57 ` jason at gcc dot gnu.org
2013-02-13 18:05 ` jason at gcc dot gnu.org
2013-02-15 19:32 ` jason 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).