public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62204] New: internal compiler error with -Wall
@ 2014-08-20 15:29 koes at cmu dot edu
  2015-02-19 18:21 ` [Bug c++/62204] " koes at cmu dot edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: koes at cmu dot edu @ 2014-08-20 15:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

            Bug ID: 62204
           Summary: internal compiler error with -Wall
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: koes at cmu dot edu

Created attachment 33369
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33369&action=edit
preprocessed file for reproducing -Wall related bug

I get an internal compiler error when compiling pharmer (http://pharmer.sf.net)
under Ubuntu 14.04 with the packaged g++ 4.8.2 and with a version of 4.8.3 I
built myself (../configure --enable-languages=c,c++,fortran x86_64-linux-gnu
).  The problem may also be present in 4.9.1, but manifest differently.

The command line to reproduce this error in 4.8.2/4.8.3 is:
 g++  -O3 -Wall -c   main.ii

Interestingly, there is another file in the build that gets a similar error
(PharmerQuery.cpp). For this file removing -Wall does not resolve the crash,
but passing -save-temps does, so it is difficult to provide a preprocessed
file. g++ 4.9.1 also cannot compile this file, although with 4.9.1 this ICE
goes away with the removal of -Wall (as well as -save-temps).

Below I've pasted both the output for main.ii (where removing -Wall fixes the
problem) and the output for PharmerQuery.cpp (where I can't provide a .ii
file).

koes@nova:~/workspace/pharmer/Release$ g++  -O3 -Wall -c   main.ii -v
Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-linux-gnu
Configured with: ../configure --enable-languages=c,c++,fortran x86_64-linux-gnu
Thread model: posix
gcc version 4.8.3 (GCC) 
COLLECT_GCC_OPTIONS='-O3' '-Wall' '-c' '-v' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /raid/usr/local/bin/../libexec/gcc/x86_64-linux-gnu/4.8.3/cc1plus
-fpreprocessed main.ii -quiet -dumpbase main.ii -mtune=generic -march=x86-64
-auxbase main -O3 -Wall -version -o /tmp/ccpGqbNt.s
GNU C++ (GCC) version 4.8.3 (x86_64-linux-gnu)
    compiled by GNU C version 4.8.3, 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++ (GCC) version 4.8.3 (x86_64-linux-gnu)
    compiled by GNU C version 4.8.3, 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: 1cbd2130c9c03c77c4428f506cfeafb2
In file included from /usr/include/boost/algorithm/string/split.hpp:16:0,
                 from /usr/include/boost/algorithm/string.hpp:23,
                 from ../queryparsers.h:34,
                 from ../main.cpp:44:
/usr/include/boost/algorithm/string/iter_find.hpp: In instantiation of
‘SequenceSequenceT& boost::algorithm::iter_split(SequenceSequenceT&, RangeT&,
FinderT) [with SequenceSequenceT = std::vector<std::basic_string<char> >;
RangeT = std::basic_string<char>; FinderT =
boost::algorithm::detail::token_finderF<int (*)(int)throw ()>]’:
/usr/include/boost/algorithm/string/split.hpp:149:69:   required from
‘SequenceSequenceT& boost::algorithm::split(SequenceSequenceT&, RangeT&,
PredicateT, boost::algorithm::token_compress_mode_type) [with SequenceSequenceT
= std::vector<std::basic_string<char> >; RangeT = std::basic_string<char>;
PredicateT = int (*)(int)throw ()]’
../queryparsers.h:237:50:   required from here
/usr/include/boost/algorithm/string/iter_find.hpp:182:9: internal compiler
error: Segmentation fault
         }
         ^
0x89ffdf crash_signal
    ../../gcc/toplev.c:332
0x5b236a c_tree_chain_next
    ../../gcc/c-family/c-common.h:1058
0x5b236a gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:158
0x5b2d01 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:495
0x5b3346 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:520
0x5b3743 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:509
0x5b3989 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:260
0x5cd8a5 gt_ggc_mx_cp_binding_level(void*)
    ./gt-cp-name-lookup.h:64
0x5b269f gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:659
0x5b3787 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:366
0x5b2c84 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:476
0x5b3885 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:243
0x5cd993 gt_ggc_mx_cxx_binding(void*)
    ./gt-cp-name-lookup.h:87
0x5b269f gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:659
0x5b3787 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:366
0x5b3755 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:510
0x5b4089 gt_ggc_mx_lang_type(void*)
    ./gt-cp-tree.h:795
0x5b2d4a gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:500
0x5b2d39 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:499
0x5b376b gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:364
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.



g++ -DOUTPUTSMINA -DEIGEN_DISABLE_STACK_SIZE_ASSERT
-I/usr/local/include/openbabel-2.0 -I"/home/dkoes/git/code/src/lib"
-I/usr/include/jsoncpp -I/usr/local/include -I/usr0/local/include -O3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"PharmerQuery.d" -MT"PharmerQuery.d"
-o"PharmerQuery.o" "../PharmerQuery.cpp"
../PharmerQuery.cpp: In constructor ‘std::map<_Key, _Tp, _Compare,
_Alloc>::map() [with _Key = boost::exception_detail::type_info_; _Tp =
boost::shared_ptr<boost::exception_detail::error_info_base>; _Compare =
std::less<boost::exception_detail::type_info_>; _Alloc =
std::allocator<std::pair<const boost::exception_detail::type_info_,
boost::shared_ptr<boost::exception_detail::error_info_base> > >]’:
../PharmerQuery.cpp:836:1: internal compiler error: Segmentation fault
 }
 ^
0x89ffdf crash_signal
    ../../gcc/toplev.c:332
0x5b236a c_tree_chain_next
    ../../gcc/c-family/c-common.h:1058
0x5b236a gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:158
0x5b2d01 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:495
0x5b2d1d gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:497
0x5b3525 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:309
0x5b2d5b gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:501
0x5b4043 gt_ggc_mx_lang_type(void*)
    ./gt-cp-tree.h:790
0x5b2d4a gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:500
0x5b2c76 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:475
0x5b2c76 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:475
0x5b3525 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:309
0x5b2d5b gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:501
0x5b4043 gt_ggc_mx_lang_type(void*)
    ./gt-cp-tree.h:790
0x5b2d4a gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:500
0x5b2c76 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:475
0x5b3755 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:510
0x5b2d5b gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:501
0x5b2f06 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:384
0x5b30e5 gt_ggc_mx_lang_tree_node(void*)
    ./gt-cp-tree.h:551
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [PharmerQuery.o] Error 1
>From gcc-bugs-return-458875-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 20 15:57:25 2014
Return-Path: <gcc-bugs-return-458875-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29173 invoked by alias); 20 Aug 2014 15:57:25 -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 29105 invoked by uid 55); 20 Aug 2014 15:57:21 -0000
From: "sje at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/49191] gcc.dg/memcpy-3.c FAILs on SPARC
Date: Wed, 20 Aug 2014 15:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: sje at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.6.2
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-49191-4-NKsL3NSJK2@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-49191-4@http.gcc.gnu.org/bugzilla/>
References: <bug-49191-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-08/txt/msg01372.txt.bz2
Content-length: 440

https://gcc.gnu.org/bugzilla/show_bug.cgi?idI191

--- Comment #16 from Steve Ellcey <sje at gcc dot gnu.org> ---
Author: sje
Date: Wed Aug 20 15:56:45 2014
New Revision: 214226

URL: https://gcc.gnu.org/viewcvs?rev!4226&root=gcc&view=rev
Log:
2014-08-20  Steve Ellcey  <sellcey@mips.com>

    PR middle-end/49191
    * doc/sourcebuild.texi (non_strict_align): New.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/sourcebuild.texi


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

* [Bug c++/62204] internal compiler error with -Wall
  2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
@ 2015-02-19 18:21 ` koes at cmu dot edu
  2015-02-19 18:39 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: koes at cmu dot edu @ 2015-02-19 18:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

--- Comment #1 from David Koes <koes at cmu dot edu> ---
Okay, I figured this out.  It is a use after free error. Line numbers are for
4.8.4. The root cause was that I had these two lines in different header files:

typedef long int128_t __attribute__((mode(TI))) __attribute__((aligned(8)));
typedef long int128_t __attribute__((mode(TI)));

The declaration with the alignment was processed by handle_aligned_attribute in
c-common.c:7446 where the type was copied and the declartion was set to the
type's name:
      tree tt = TREE_TYPE (decl);
      *type = build_variant_type_copy (*type);
      DECL_ORIGINAL_TYPE (decl) = tt;
      TYPE_NAME (*type) = decl;
      TREE_USED (*type) = TREE_USED (decl);
      TREE_TYPE (decl) = *type;

Later, in duplicate_decls (decl.c) the aligned declaration is newdecl and the
unaligned declaration is olddecl and newdecl is ultimately freed and clobbered,
but the pointer set in handle_aligned_attribute is still around.  The memory is
eventually reallocated and the data overwritten.  Later, when instantiating
templates, this tree pointer (now pointing to something that isn't a tree) is
accessed and the compiler crashes.

It's easy enough for me to fix my code to prevent the crash, but I generally
think that no code should make the compiler crash.

I'm not sure what the standard says (especially since this involves
__attribute__), but it seems like declaring the same type with different
alignments should probably be an error.

If this is not an error, then duplicate_decls either shouldn't merge these two
types, or should correct the tree to not refer to the stale pointer.


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

* [Bug c++/62204] internal compiler error with -Wall
  2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
  2015-02-19 18:21 ` [Bug c++/62204] " koes at cmu dot edu
@ 2015-02-19 18:39 ` mpolacek at gcc dot gnu.org
  2015-02-19 20:41 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-19 18:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-19
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.3
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed for 4.9, but can't reproduce with 4.8.  Trunks seems to be fine, let
me see what fixed it...


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

* [Bug c++/62204] internal compiler error with -Wall
  2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
  2015-02-19 18:21 ` [Bug c++/62204] " koes at cmu dot edu
  2015-02-19 18:39 ` mpolacek at gcc dot gnu.org
@ 2015-02-19 20:41 ` mpolacek at gcc dot gnu.org
  2015-06-26 20:11 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-02-19 20:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed by r218729 I think.


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

* [Bug c++/62204] internal compiler error with -Wall
  2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
                   ` (2 preceding siblings ...)
  2015-02-19 20:41 ` mpolacek at gcc dot gnu.org
@ 2015-06-26 20:11 ` jakub at gcc dot gnu.org
  2015-06-26 20:36 ` jakub at gcc dot gnu.org
  2015-06-26 21:18 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.3 has been released.


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

* [Bug c++/62204] internal compiler error with -Wall
  2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
                   ` (3 preceding siblings ...)
  2015-06-26 20:11 ` jakub at gcc dot gnu.org
@ 2015-06-26 20:36 ` jakub at gcc dot gnu.org
  2015-06-26 21:18 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.3                       |4.9.4


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

* [Bug c++/62204] internal compiler error with -Wall
  2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
                   ` (4 preceding siblings ...)
  2015-06-26 20:36 ` jakub at gcc dot gnu.org
@ 2015-06-26 21:18 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-06-26 21:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62204

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.9.4                       |5.0

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-06-26 21:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 15:29 [Bug c++/62204] New: internal compiler error with -Wall koes at cmu dot edu
2015-02-19 18:21 ` [Bug c++/62204] " koes at cmu dot edu
2015-02-19 18:39 ` mpolacek at gcc dot gnu.org
2015-02-19 20:41 ` mpolacek at gcc dot gnu.org
2015-06-26 20:11 ` jakub at gcc dot gnu.org
2015-06-26 20:36 ` jakub at gcc dot gnu.org
2015-06-26 21:18 ` pinskia 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).