public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file
@ 2013-02-28 10:32 doko at gcc dot gnu.org
  2013-02-28 12:00 ` [Bug c++/56481] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: doko at gcc dot gnu.org @ 2013-02-28 10:32 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56481
           Summary: [4.8 Regression] endless loop compiling a C++ file
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: doko@gcc.gnu.org


Created attachment 29549
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29549
preprocessed source

seen with 4.8.0 20130223 (experimental) [trunk revision 196236]
seen as well with -g, -fopenmp, -O

$ g++ -c GuiFilesModified.ii

0  0x00000000005e2a3e in ?? ()
#1  0x00000000005e2f5d in ?? ()
#2  0x00000000005e357f in ?? ()
#3  0x00000000005e2b22 in ?? ()
#4  0x00000000005e4ca7 in ?? ()
#5  0x00000000005e5a4a in ?? ()
#6  0x00000000005e4f2a in maybe_constant_value(tree_node*) ()
#7  0x00000000005e5a4a in ?? ()
#8  0x00000000005e4f2a in maybe_constant_value(tree_node*) ()
#9  0x00000000005e5a4a in ?? ()
#10 0x00000000005e5481 in ?? ()
#11 0x00000000005e4f2a in maybe_constant_value(tree_node*) ()
#12 0x00000000005e5a4a in ?? ()
#13 0x00000000005e5481 in ?? ()
#14 0x00000000005e5481 in ?? ()
#15 0x00000000005e5481 in ?? ()
#16 0x00000000005e4f2a in maybe_constant_value(tree_node*) ()
#17 0x00000000005e5a4a in ?? ()
#18 0x00000000005e4f2a in maybe_constant_value(tree_node*) ()
#19 0x00000000005e5a4a in ?? ()
#20 0x00000000005e4f2a in maybe_constant_value(tree_node*) ()


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
@ 2013-02-28 12:00 ` jakub at gcc dot gnu.org
  2013-02-28 16:58 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-28 12:00 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-28
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-28 11:59:57 UTC ---
Reduced testcase:
struct S
{
  bool foo () const;
#define A(n) , f##n##0, f##n##1, f##n##2, f##n##3
#define B(n) A(n##0) A(n##1) A(n##2) A(n##3)
#define C B(0) B(1) B(2) B(3)
  bool f C;
};

bool
S::foo () const
{
#undef A
#define A(n) && f##n##0 && f##n##1 && f##n##2 && f##n##3
  const bool ret = f C;
  return ret;
}


Started with my http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192862
It actually isn't endless, just the compile time complexity is bad.

The problem is I think in:
        if (!potential_constant_expression_1 (op, rval, flags))
          return false;
        if (!processing_template_decl)
          op = maybe_constant_value (op);
in TRUTH_{AND,OR}*_EXPR handling in potential_constant_expression_1, because
maybe_constant_value calls potential_constant_expression (op) again.
They are called with different second/third argument (false, tf_none inside
maybe_constant_value, or true (== rval), flags above) though, so I think the
fix wouldn't be as easy as inlining maybe_constant_value by hand here and
avoiding the potential_constant_expression there.
Jason, any ideas?
For large && or || expressions perhaps we could just handle the cases where
op is the same code specially, still we wouldn't get rid of the large
complexity if say TRUTH_AND*_EXPR is only in every second code and there is
some other code in between.


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
  2013-02-28 12:00 ` [Bug c++/56481] " jakub at gcc dot gnu.org
@ 2013-02-28 16:58 ` jason at gcc dot gnu.org
  2013-02-28 17:36 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-28 16:58 UTC (permalink / raw)
  To: gcc-bugs


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

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

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


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
  2013-02-28 12:00 ` [Bug c++/56481] " jakub at gcc dot gnu.org
  2013-02-28 16:58 ` jason at gcc dot gnu.org
@ 2013-02-28 17:36 ` jakub at gcc dot gnu.org
  2013-02-28 20:22 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-28 17:36 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-28 17:35:47 UTC ---
With -std=c++11 this actually started already with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189851
when that code has been introduced in potential_constant_expression_1.


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-02-28 17:36 ` jakub at gcc dot gnu.org
@ 2013-02-28 20:22 ` jason at gcc dot gnu.org
  2013-02-28 20:37 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-28 20:22 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-28 20:21:36 UTC ---
Author: jason
Date: Thu Feb 28 20:21:23 2013
New Revision: 196358

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196358
Log:
    PR c++/56481
    * semantics.c (potential_constant_expression_1): Use
    cxx_eval_outermost_constant_expr rather than maybe_constant_value.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-02-28 20:22 ` jason at gcc dot gnu.org
@ 2013-02-28 20:37 ` jason at gcc dot gnu.org
  2013-02-28 20:45 ` jakub at gcc dot gnu.org
  2013-03-17  2:38 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-28 20:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-28 20:36:54 UTC ---
Author: jason
Date: Thu Feb 28 20:36:47 2013
New Revision: 196359

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196359
Log:
    PR c++/56481
    * g++.dg/cpp0x/constexpr-and.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-and.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-02-28 20:37 ` jason at gcc dot gnu.org
@ 2013-02-28 20:45 ` jakub at gcc dot gnu.org
  2013-03-17  2:38 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-02-28 20:45 UTC (permalink / raw)
  To: gcc-bugs


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

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> 2013-02-28 20:45:26 UTC ---
Fixed, thanks.


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

* [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file
  2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-02-28 20:45 ` jakub at gcc dot gnu.org
@ 2013-03-17  2:38 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-17  2:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-17 02:37:34 UTC ---
Author: jason
Date: Sun Mar 17 02:37:21 2013
New Revision: 196737

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196737
Log:
    PR c++/56481
    * semantics.c (potential_constant_expression_1): Use of 'this' in
    a non-constexpr function makes the expression not potentially
    constant.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28 10:32 [Bug c++/56481] New: [4.8 Regression] endless loop compiling a C++ file doko at gcc dot gnu.org
2013-02-28 12:00 ` [Bug c++/56481] " jakub at gcc dot gnu.org
2013-02-28 16:58 ` jason at gcc dot gnu.org
2013-02-28 17:36 ` jakub at gcc dot gnu.org
2013-02-28 20:22 ` jason at gcc dot gnu.org
2013-02-28 20:37 ` jason at gcc dot gnu.org
2013-02-28 20:45 ` jakub at gcc dot gnu.org
2013-03-17  2:38 ` 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).