public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp
@ 2014-02-11 15:59 tweenk.pl at gmail dot com
  2014-02-14 17:31 ` [Bug c++/60146] [4.8/4.9 Regression] " reichelt at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: tweenk.pl at gmail dot com @ 2014-02-11 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60146
           Summary: Regression: ICE when compiling this code with -fopenmp
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tweenk.pl at gmail dot com

The linked preprocessed code compiled correctly in GCC 4.7.x (Ubuntu 13.04).
After upgrade to GCC 4.8.1 (Ubuntu 13.10), it crashes.

The code is too big (3.1MB) to attach it to the bug report and cannot be easily
reduced, so I'm providing a download link:

http://osch.chem.uw.edu.pl/gccbug.cpp

Compile with: g++ -fopenmp gccbug.cpp -c -o gccbug.o

Output:

In file included from ../tests/../common/include/Spectrum.h:16:0,
                 from ../tests/TestSpectralData.cpp:2:
../tests/../common/include/SpectralData.h: In instantiation of
‘SpectrumRegionAxis<<anonymous>, <template-parameter-1-2>,
<template-parameter-1-3>, <anonymous> >::Self& SpectrumRegionAxis<<anonymous>,
<template-parameter-1-2>, <template-parameter-1-3>, <anonymous>
>::operator=(const Self&) [with unsigned int D = 4u; C = short unsigned int; T
= float; unsigned int BLOCKSIZE = 32u; SpectrumRegionAxis<<anonymous>,
<template-parameter-1-2>, <template-parameter-1-3>, <anonymous> >::Self =
SpectrumRegionAxis<4u, short unsigned int, float, 32u>]’:
../tests/../common/include/SpectralData.h:1195:8:   required from
‘BinaryOutput& operator<<(BinaryOutput&, const SpectrumRegionAxis<D, C, T,
BSIZE>&) [with unsigned int D = 4u; C = short unsigned int; T = float; unsigned
int BSIZE = 32u]’
../tests/../common/include/Spectrum.h:75:6:   required from ‘BinaryOutput&
operator<<(BinaryOutput&, const Spectrum<D>&) [with unsigned int D = 4u]’
../tests/TestSpectralData.cpp:163:9:   required from here
../tests/../common/include/SpectralData.h:650:5: internal compiler error:
Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccsMy4oS.out file, please attach this to
your bugreport.
>From gcc-bugs-return-443303-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Feb 11 16:02:44 2014
Return-Path: <gcc-bugs-return-443303-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11010 invoked by alias); 11 Feb 2014 16:02:43 -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 10804 invoked by uid 48); 11 Feb 2014 16:02:40 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/52370] [4.7/4.8/4.9 Regression] Spurious "may be used uninitialized" warning for check of optional argument
Date: Tue, 11 Feb 2014 16:02:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-52370-4-yjBRQ3MaJz@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-52370-4@http.gcc.gnu.org/bugzilla/>
References: <bug-52370-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-02/txt/msg01060.txt.bz2
Content-length: 412

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Indeed, this regressed with r182211.


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
@ 2014-02-14 17:31 ` reichelt at gcc dot gnu.org
  2014-02-14 17:38 ` reichelt at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-14 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.7.0
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2014-02-14
                 CC|                            |reichelt at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|Regression: ICE when        |[4.8/4.9 Regression] ICE
                   |compiling this code with    |when compiling this code
                   |-fopenmp                    |with -fopenmp
      Known to fail|                            |4.8.0, 4.9.0

--- Comment #1 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Confirmed. ICEs since GCC 4.8.0.

Reduced testcase:

==========================================
int foo() { return 0; }

template<typename T> void bar()
{
#pragma omp parallel for
  for (T i = foo(); i < 8; ++i) {}
}

void baz()
{
  bar<int>();
}
==========================================

bug.cc: In instantiation of 'void bar() [with T = int]':
bug.cc:11:12:   required from here
bug.cc:6:3: internal compiler error: Segmentation fault
   for (T i = foo(); i < 8; ++i) {}
   ^
0xba523f crash_signal
        ../../gcc/gcc/toplev.c:337
0x733640 contains_struct_check
        ../../gcc/gcc/tree.h:2822
0x733640 finish_omp_for(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node*, tree_node*)
        ../../gcc/gcc/cp/semantics.c:6434
0x613325 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13637
0x61250c tsubst_expr
        ../../gcc/gcc/cp/pt.c:13586
0x61208c tsubst_expr
        ../../gcc/gcc/cp/pt.c:13424
0x60f2a9 instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:19690
0x64d8c7 instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:19806
0x688bed cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4148
Please submit a full bug report, [etc.]


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
  2014-02-14 17:31 ` [Bug c++/60146] [4.8/4.9 Regression] " reichelt at gcc dot gnu.org
@ 2014-02-14 17:38 ` reichelt at gcc dot gnu.org
  2014-02-16 19:36 ` reichelt at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-14 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.4


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
  2014-02-14 17:31 ` [Bug c++/60146] [4.8/4.9 Regression] " reichelt at gcc dot gnu.org
  2014-02-14 17:38 ` reichelt at gcc dot gnu.org
@ 2014-02-16 19:36 ` reichelt at gcc dot gnu.org
  2014-02-17 10:40 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-16 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.4                       |4.8.3


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (2 preceding siblings ...)
  2014-02-16 19:36 ` reichelt at gcc dot gnu.org
@ 2014-02-17 10:40 ` jakub at gcc dot gnu.org
  2014-02-17 17:34 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-17 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (3 preceding siblings ...)
  2014-02-17 10:40 ` jakub at gcc dot gnu.org
@ 2014-02-17 17:34 ` jakub at gcc dot gnu.org
  2014-02-17 18:45 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-17 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
decl in this case in tsubst_omp_for_iterator is i, and init is DECL_EXPR i, i
has DECL_INITIAL set to the function call.  RECUR on both of these will tsubst
the initializer before the loop, rather than in the loop, thus init is later on
NULL.  For #pragma omp for we really need the initializer.

I'm afraid I haven't understood fully the PR53565 fix though.


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (4 preceding siblings ...)
  2014-02-17 17:34 ` jakub at gcc dot gnu.org
@ 2014-02-17 18:45 ` jakub at gcc dot gnu.org
  2014-02-24 19:03 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-17 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I've tried:
--- pt.c.jj3    2014-02-12 17:46:47.000000000 +0100
+++ pt.c    2014-02-17 19:22:36.617413387 +0100
@@ -13057,10 +13057,28 @@ tsubst_omp_for_iterator (tree t, int i,
   init = TREE_OPERAND (init, 1);
   /* Do this before substituting into decl to handle 'auto'.  */
   init_decl = (init && TREE_CODE (init) == DECL_EXPR);
-  init = RECUR (init);
-  decl = RECUR (decl);
+  decl = tsubst (decl, args, complain, in_decl);
+  if (decl == error_mark_node)
+    return;
+
+  if (decl != error_mark_node
+      && !CLASS_TYPE_P (TREE_TYPE (decl))
+      && init_decl)
+    {
+      tree old_decl = DECL_EXPR_DECL (init);
+      tree initial = DECL_INITIAL (old_decl);
+      DECL_INITIAL (old_decl) = NULL_TREE;
+      init = RECUR (init);
+      DECL_INITIAL (old_decl) = initial;
+      if (init == error_mark_node)
+    return;
+      init = RECUR (initial);
+      init_decl = false;
+    }
+  else
+    init = RECUR (init);

-  if (decl == error_mark_node || init == error_mark_node)
+  if (init == error_mark_node)
     return;

   if (init_decl)

but that breaks libgomp.c++/for-2.C test, so I'm stuck.


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (5 preceding siblings ...)
  2014-02-17 18:45 ` jakub at gcc dot gnu.org
@ 2014-02-24 19:03 ` jason at gcc dot gnu.org
  2014-02-24 22:18 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-24 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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


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

* [Bug c++/60146] [4.8/4.9 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (6 preceding siblings ...)
  2014-02-24 19:03 ` jason at gcc dot gnu.org
@ 2014-02-24 22:18 ` jason at gcc dot gnu.org
  2014-02-24 22:23 ` [Bug c++/60146] [4.8 " jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-24 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Mon Feb 24 22:17:43 2014
New Revision: 208094

URL: http://gcc.gnu.org/viewcvs?rev=208094&root=gcc&view=rev
Log:
    PR c++/60146
    * pt.c (tsubst_omp_for_iterator): Don't let substitution of the
    DECL_EXPR initialize a non-class iterator.

Added:
    trunk/gcc/testsuite/g++.dg/gomp/for-20.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c


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

* [Bug c++/60146] [4.8 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (7 preceding siblings ...)
  2014-02-24 22:18 ` jason at gcc dot gnu.org
@ 2014-02-24 22:23 ` jason at gcc dot gnu.org
  2014-03-01 18:44 ` jason at gcc dot gnu.org
  2014-03-01 19:18 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-02-24 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.8/4.9 Regression] ICE    |[4.8 Regression] ICE when
                   |when compiling this code    |compiling this code with
                   |with -fopenmp               |-fopenmp

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed in 4.9 so far.


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

* [Bug c++/60146] [4.8 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (8 preceding siblings ...)
  2014-02-24 22:23 ` [Bug c++/60146] [4.8 " jason at gcc dot gnu.org
@ 2014-03-01 18:44 ` jason at gcc dot gnu.org
  2014-03-01 19:18 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-03-01 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Sat Mar  1 18:43:24 2014
New Revision: 208244

URL: http://gcc.gnu.org/viewcvs?rev=208244&root=gcc&view=rev
Log:
    PR c++/60146
    * pt.c (tsubst_omp_for_iterator): Don't let substitution of the
    DECL_EXPR initialize a non-class iterator.


Conflicts:
    gcc/cp/pt.c

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/gomp/for-20.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/pt.c


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

* [Bug c++/60146] [4.8 Regression] ICE when compiling this code with -fopenmp
  2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
                   ` (9 preceding siblings ...)
  2014-03-01 18:44 ` jason at gcc dot gnu.org
@ 2014-03-01 19:18 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2014-03-01 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.3.


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

end of thread, other threads:[~2014-03-01 19:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11 15:59 [Bug c++/60146] New: Regression: ICE when compiling this code with -fopenmp tweenk.pl at gmail dot com
2014-02-14 17:31 ` [Bug c++/60146] [4.8/4.9 Regression] " reichelt at gcc dot gnu.org
2014-02-14 17:38 ` reichelt at gcc dot gnu.org
2014-02-16 19:36 ` reichelt at gcc dot gnu.org
2014-02-17 10:40 ` jakub at gcc dot gnu.org
2014-02-17 17:34 ` jakub at gcc dot gnu.org
2014-02-17 18:45 ` jakub at gcc dot gnu.org
2014-02-24 19:03 ` jason at gcc dot gnu.org
2014-02-24 22:18 ` jason at gcc dot gnu.org
2014-02-24 22:23 ` [Bug c++/60146] [4.8 " jason at gcc dot gnu.org
2014-03-01 18:44 ` jason at gcc dot gnu.org
2014-03-01 19:18 ` 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).