public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE
@ 2012-10-02  8:22 daniel.kruegler at googlemail dot com
  2012-10-02  9:08 ` [Bug c++/54777] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-02  8:22 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54777
           Summary: [C++11] Comma operator in constexpr environment can
                    cause ICE
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


Using gcc 4.8.0 20120923 (experimental) and compiler flags

-Wall -pedantic -std=c++11

the following code gives an ICE:

//-------------
struct array {
    int data[1];
    constexpr const int& at(unsigned i)
    {
      return (i < 1 ? 0 : throw 1), data[i];
      //return i < 1 ? data[i] : (throw 0, data[i]); // OK
    }
};

int main() {
  constexpr array a{};
  constexpr int i = a.at(0);
}
//-------------

"
main.cpp||In function 'int main()':|
main.cpp|12|  in constexpr expansion of 'a.array::at(0u)'|
main.cpp|12|internal compiler error: in adjust_temp_type, at
cp/semantics.c:6425|
"

The code should be accepted.


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
@ 2012-10-02  9:08 ` mpolacek at gcc dot gnu.org
  2012-10-02 10:18 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-10-02  9:08 UTC (permalink / raw)
  To: gcc-bugs


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-02
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-10-02 09:08:18 UTC ---
Happens also with 4.7 HEAD.


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
  2012-10-02  9:08 ` [Bug c++/54777] " mpolacek at gcc dot gnu.org
@ 2012-10-02 10:18 ` jakub at gcc dot gnu.org
  2012-10-02 10:19 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-02 10:18 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-02 10:18:27 UTC ---
Created attachment 28325
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28325
gcc48-pr54777.patch

Untested fix.  Guess at least 4.7 and perhaps also 4.6 should get the fix.


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
  2012-10-02  9:08 ` [Bug c++/54777] " mpolacek at gcc dot gnu.org
  2012-10-02 10:18 ` jakub at gcc dot gnu.org
@ 2012-10-02 10:19 ` jakub at gcc dot gnu.org
  2012-10-03 14:21 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-02 10:19 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.4


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2012-10-02 10:19 ` jakub at gcc dot gnu.org
@ 2012-10-03 14:21 ` jakub at gcc dot gnu.org
  2012-10-03 14:27 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-03 14:21 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-03 14:21:24 UTC ---
Author: jakub
Date: Wed Oct  3 14:21:20 2012
New Revision: 192036

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192036
Log:
    PR c++/54777
    * semantics.c (cxx_eval_constant_expression) <case COMPOUND_EXPR>: If
    not ignoring the second operand, pass the original second operand
    and not one with stripped nops to cxx_eval_constant_expression.

    * g++.dg/cpp0x/constexpr-ref4.C: New test.

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


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2012-10-03 14:21 ` jakub at gcc dot gnu.org
@ 2012-10-03 14:27 ` jakub at gcc dot gnu.org
  2012-10-03 14:32 ` jakub at gcc dot gnu.org
  2012-11-29 21:28 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-03 14:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-03 14:27:35 UTC ---
Author: jakub
Date: Wed Oct  3 14:27:30 2012
New Revision: 192037

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192037
Log:
    PR c++/54777
    * semantics.c (cxx_eval_constant_expression) <case COMPOUND_EXPR>: If
    not ignoring the second operand, pass the original second operand
    and not one with stripped nops to cxx_eval_constant_expression.

    * g++.dg/cpp0x/constexpr-ref4.C: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-ref4.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/semantics.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2012-10-03 14:27 ` jakub at gcc dot gnu.org
@ 2012-10-03 14:32 ` jakub at gcc dot gnu.org
  2012-11-29 21:28 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-03 14:32 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-03 14:31:35 UTC ---
Fixed for 4.7+.


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

* [Bug c++/54777] [C++11] Comma operator in constexpr environment can cause ICE
  2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
                   ` (5 preceding siblings ...)
  2012-10-03 14:32 ` jakub at gcc dot gnu.org
@ 2012-11-29 21:28 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-29 21:28 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |akrzemi1 at gmail dot com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-29 21:28:13 UTC ---
*** Bug 55537 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2012-11-29 21:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
2012-10-02  9:08 ` [Bug c++/54777] " mpolacek at gcc dot gnu.org
2012-10-02 10:18 ` jakub at gcc dot gnu.org
2012-10-02 10:19 ` jakub at gcc dot gnu.org
2012-10-03 14:21 ` jakub at gcc dot gnu.org
2012-10-03 14:27 ` jakub at gcc dot gnu.org
2012-10-03 14:32 ` jakub at gcc dot gnu.org
2012-11-29 21:28 ` 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).