public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed
@ 2013-12-29 16:46 nheghathivhistha at gmail dot com
  2013-12-29 17:17 ` [Bug other/59622] [4.9 Regression] internal " glisse at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: nheghathivhistha at gmail dot com @ 2013-12-29 16:46 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3647 bytes --]

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

            Bug ID: 59622
           Summary: trung gcc-4.9.0:internal compiler error: verify_gimple
                    failed
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nheghathivhistha at gmail dot com

Created attachment 31535
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31535&action=edit
Reduced precompiled source file

Gcc 4.9.0 trunk from 2013-12-28 ICEs while compiling Gentoo LLVM-3.3-r2:

x86_64-pc-linux-gnu-g++ -m32 -fvisibility-inlines-hidden -fno-exceptions -fPIC
-O2 -ggdb -pipe -march=native -mtune=native  -flto=4 -pedantic -c
./testcase.i./testcase.i: In member function ‘llvm::Value*
{anonymous}::LibCallOptimization::OptimizeCall(llvm::CallInst*,
llvm::DataLayout*, llvm::TargetLibraryInfo*, llvm::IRBuilder<>&)’:
./testcase.i:225:12: error: LHS in noreturn call
     Value *OptimizeCall (CallInst * CI, DataLayout *, TargetLibraryInfo *,
            ^
D.2995 = __builtin_unreachable (this, D.2998, 0B, MEM[(const struct IRBuilder
&)B]);
./testcase.i:225:12: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions

Crashes the same way without -flto.

Gcc-4.8.2 not ICEs but fails other way with -flto but succeeds without -flto.

C-reduce reduced testcase attached.
>From gcc-bugs-return-438705-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Dec 29 17:11:43 2013
Return-Path: <gcc-bugs-return-438705-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8201 invoked by alias); 29 Dec 2013 17:11:41 -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 8179 invoked by uid 48); 29 Dec 2013 17:11:37 -0000
From: "nheghathivhistha at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/59622] trunk gcc-4.9.0:internal compiler error: verify_gimple failed
Date: Sun, 29 Dec 2013 17:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: nheghathivhistha at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-59622-4-Yfb3Ke5ZAq@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59622-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59622-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: 2013-12/txt/msg02360.txt.bz2
Content-length: 244

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

--- Comment #1 from David Kredba <nheghathivhistha at gmail dot com> ---
Created attachment 31536
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id1536&actioníit
More c-reduced (--slow)


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

* [Bug other/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
@ 2013-12-29 17:17 ` glisse at gcc dot gnu.org
  2013-12-29 18:12 ` trippels at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-12-29 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-12-29
   Target Milestone|---                         |4.9.0
            Summary|trunk gcc-4.9.0:internal    |[4.9 Regression] internal
                   |compiler error:             |compiler error:
                   |verify_gimple failed        |verify_gimple failed
     Ever confirmed|0                           |1

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Seems related to OBJ_TYPE_REF. -O2 is sufficient.


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

* [Bug other/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
  2013-12-29 17:17 ` [Bug other/59622] [4.9 Regression] internal " glisse at gcc dot gnu.org
@ 2013-12-29 18:12 ` trippels at gcc dot gnu.org
  2013-12-30  7:39 ` trippels at gcc dot gnu.org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: trippels at gcc dot gnu.org @ 2013-12-29 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at ucw dot cz,
                   |                            |trippels at gcc dot gnu.org

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Started with r206042.


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

* [Bug other/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
  2013-12-29 17:17 ` [Bug other/59622] [4.9 Regression] internal " glisse at gcc dot gnu.org
  2013-12-29 18:12 ` trippels at gcc dot gnu.org
@ 2013-12-30  7:39 ` trippels at gcc dot gnu.org
  2013-12-30 10:16 ` jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: trippels at gcc dot gnu.org @ 2013-12-30  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Further reduced:

markus@x4 tmp % cat test.ii
namespace {
class A {
public:
  virtual int *m_fn1();
  int *m_fn2() { return m_fn1(); }
};
A a;
int b = *a.m_fn2();
}

markus@x4 tmp % g++ -O2 -c /var/tmp/test.ii
/var/tmp/test.ii: In member function ‘int* {anonymous}::A::m_fn2()’:
/var/tmp/test.ii:5:8: error: LHS in noreturn call
   int *m_fn2() { return m_fn1(); }
        ^
D.2269 = __builtin_unreachable (this);
/var/tmp/test.ii:5:8: internal compiler error: verify_gimple failed
0xb74c4f verify_gimple_in_seq(gimple_statement_base*)
        ../../gcc/gcc/tree-cfg.c:4521
0x99ffe1 gimplify_body(tree_node*, bool)
        ../../gcc/gcc/gimplify.c:8599
0x9a0399 gimplify_function_tree(tree_node*)
        ../../gcc/gcc/gimplify.c:8684
0x82eb97 analyze_function
        ../../gcc/gcc/cgraphunit.c:649
0x82fe4b analyze_functions
        ../../gcc/gcc/cgraphunit.c:1017
0x831475 finalize_compilation_unit()
        ../../gcc/gcc/cgraphunit.c:2271
0x62a57e cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4431
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.

markus@x4 tmp % clang++ -c /var/tmp/test.ii
/var/tmp/test.ii:4:16: warning: function '<anonymous namespace>::A::m_fn1' has
internal linkage but is not defined [-Wundefined-internal]
  virtual int *m_fn1();
               ^
/var/tmp/test.ii:5:25: note: used here
  int *m_fn2() { return m_fn1(); }
                        ^
1 warning generated.
markus@x4 tmp %
>From gcc-bugs-return-438727-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 30 08:18:16 2013
Return-Path: <gcc-bugs-return-438727-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29836 invoked by alias); 30 Dec 2013 08:18:15 -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 29778 invoked by uid 48); 30 Dec 2013 08:18:10 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59625] New: asm goto and TARGET_FOUR_JUMP_LIMIT
Date: Mon, 30 Dec 2013 08:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc
Message-ID: <bug-59625-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: 2013-12/txt/msg02382.txt.bz2
Content-length: 2193

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

            Bug ID: 59625
           Summary: asm goto and TARGET_FOUR_JUMP_LIMIT
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, rth at gcc dot gnu.org

On the following testcase (with 4.8 with say -O2 -mtune=generic, with 4.9
starting with r203012 with e.g. -O2 -mtune=atom) we generate extra .p2align
directives in between the asm goto.

#define EFAULT 14

#define put_user_try do {\
  __label__ put_user_fail;\
  stac();\
  barrier();

#define put_user_catch(err)\
  clac();\
  if (0) {\
   put_user_fail:\
    clac();\
    (err) = -EFAULT;\
  }\
} while (0)

# define _ASM_EXTABLE_EX(from,to)                            \
     " .pushsection \"__ex_table\",\"a\"\n"                  \
     " .balign 8\n"                                          \
     " .long (" #from ") - .\n"                              \
     " .long (" #to ") - . + 0x7ffffff0\n"                   \
     " .popsection\n"

#define __put_user_asm_ex(x, addr, itype, rtype, ltype)\
asm goto("1:mov"itype" %"rtype"0,%1\n"\
     _ASM_EXTABLE_EX(1b, %l[put_user_fail])\
     : : ltype(x), "m" (addr) : : put_user_fail)

int main(int argc, char **argv)
{
  int err = 0;

  put_user_try {
    __put_user_asm_ex(0, argv[0], "q", "", "er");
    __put_user_asm_ex(0, argv[1], "q", "", "er");
    __put_user_asm_ex(0, argv[2], "q", "", "er");
    __put_user_asm_ex(0, argv[3], "q", "", "er");
    __put_user_asm_ex(0, argv[4], "q", "", "er");
  } put_user_catch(err);
  return err;
}

This is from TARGET_FOUR_JUMP_LIMIT ix86_avoid_jump_mispredicts.  Perhaps we
shouldn't count asm goto as a jump there (i.e. add
"&& asm_noperands (PATTERN (insn)) < 0"
next to every JUMP_P (insn) in that routine)?  Because while asm goto could
contain a jump, it can contain something completely different too (as in this
case), not to mention that we have to conservatively count the asm goto as
occupying 0 bytes in the cache line.


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

* [Bug other/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (2 preceding siblings ...)
  2013-12-30  7:39 ` trippels at gcc dot gnu.org
@ 2013-12-30 10:16 ` jakub at gcc dot gnu.org
  2013-12-30 10:49 ` [Bug tree-optimization/59622] " jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-30 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
              if (targets.length () == 1)
                fndecl = targets[0]->decl;
              else
                fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
              gimple_call_set_fndecl (stmt, fndecl);
in gimple_fold_call is obviously wrong for the targets.length () == 0 case,
__builtin_unreachable () has no arguments, not the arguments of the call, and
no return value.
So, IMNSHO, for targets.length () == 0 you want to punt if inplace is true, and
otherwise not update the call itself, but replace the old call with a new stmt,
__builtin_unreachable ();, and if the call had a lhs with gimple_reg_type, add
lhs = 0 (build_zero_cst (TREE_TYPE (lhs))) after the __builtin_unreachable (),
so that it is defined, it will be hopefully DCEd soon afterwards but we
shouldn't let it being undefined, especially if it is e.g. anonymous SSA_NAME
which can't be undefined.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (3 preceding siblings ...)
  2013-12-30 10:16 ` jakub at gcc dot gnu.org
@ 2013-12-30 10:49 ` jakub at gcc dot gnu.org
  2013-12-30 10:53 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-30 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 31539
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31539&action=edit
gcc49-pr59622.patch

Untested fix.  I think just adding __builtin_unreachable () call before the
call and not folding the call at all is best, no need to attempt to handle the
lhs etc., DCE will do it's job later on.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (4 preceding siblings ...)
  2013-12-30 10:49 ` [Bug tree-optimization/59622] " jakub at gcc dot gnu.org
@ 2013-12-30 10:53 ` jakub at gcc dot gnu.org
  2013-12-30 21:29 ` hubicka at gcc dot gnu.org
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-30 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
BTW, I wonder if we shouldn't issue a warning on this testcase, if the vtable
(and virtual method) are in anonymous namespace and aren't defined in the
current CU, they can't be defined anywhere else and thus it is a user error not
to define them (or the class shouldn't be used where the vtable is needed).
At -O0 on the testcase we end up with _ZTVN12_GLOBAL__N_11AE undefined symbol
(that, again, can't be defined anywhere else), so that is at least link time
error, but at -O2 we don't get that.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (5 preceding siblings ...)
  2013-12-30 10:53 ` jakub at gcc dot gnu.org
@ 2013-12-30 21:29 ` hubicka at gcc dot gnu.org
  2013-12-30 21:33 ` hubicka at gcc dot gnu.org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hubicka at gcc dot gnu.org @ 2013-12-30 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

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

--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
About the warning, I think it would lead to false positives.  We can specialize
function for particular type and the type may not define a virtual method.
User may have earlier correctly tested the dynamic type of the objects making
the code path dead.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (6 preceding siblings ...)
  2013-12-30 21:29 ` hubicka at gcc dot gnu.org
@ 2013-12-30 21:33 ` hubicka at gcc dot gnu.org
  2013-12-31  4:54 ` nheghathivhistha at gmail dot com
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hubicka at gcc dot gnu.org @ 2013-12-30 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
My comment was about warning at a time we fold to unreachable. Higher level
warning a-la clang is of course good idea.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (7 preceding siblings ...)
  2013-12-30 21:33 ` hubicka at gcc dot gnu.org
@ 2013-12-31  4:54 ` nheghathivhistha at gmail dot com
  2013-12-31  7:47 ` nheghathivhistha at gmail dot com
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nheghathivhistha at gmail dot com @ 2013-12-31  4:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from David Kredba <nheghathivhistha at gmail dot com> ---
Hello Jakub,
I tried your patch.

/var/tmp/portage/sys-devel/llvm-3.3-r2/work/llvm-3.3.src/lib/Transforms/Scalar/SimplifyLibCalls.cpp:
In member function ‘llvm::Value*
{anonymous}::LibCallOptimization::OptimizeCall(llvm::CallInst*, const
llvm::DataLayout*, const llvm::TargetLibraryInfo*, llvm::IRBuilder<>&)’:
/var/tmp/portage/sys-devel/llvm-3.3-r2/work/llvm-3.3.src/lib/Transforms/Scalar/SimplifyLibCalls.cpp:63:10:
error: LHS in noreturn call
   Value *OptimizeCall(CallInst *CI, const DataLayout *TD,
          ^
D.109494 = __cxa_pure_virtual (this, D.109498, CI, B);
/var/tmp/portage/sys-devel/llvm-3.3-r2/work/llvm-3.3.src/lib/Transforms/Scalar/SimplifyLibCalls.cpp:63:10:
internal compiler error: verify_gimple failed

Do you need a new reduced testcase?
>From gcc-bugs-return-438817-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 31 05:01:27 2013
Return-Path: <gcc-bugs-return-438817-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18805 invoked by alias); 31 Dec 2013 05:01:27 -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 18752 invoked by uid 48); 31 Dec 2013 05:01:24 -0000
From: "nheghathivhistha at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
Date: Tue, 31 Dec 2013 05:01:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: nheghathivhistha at gmail dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59622-4-o11MMupBmr@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59622-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59622-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: 2013-12/txt/msg02472.txt.bz2
Content-length: 172

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

--- Comment #11 from David Kredba <nheghathivhistha at gmail dot com> ---
Without -m32 it not ICEs after patch applied.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (8 preceding siblings ...)
  2013-12-31  4:54 ` nheghathivhistha at gmail dot com
@ 2013-12-31  7:47 ` nheghathivhistha at gmail dot com
  2013-12-31 11:57 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nheghathivhistha at gmail dot com @ 2013-12-31  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from David Kredba <nheghathivhistha at gmail dot com> ---
Created attachment 31546
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31546&action=edit
After patch ICE generating reduced preprocessed source file


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (9 preceding siblings ...)
  2013-12-31  7:47 ` nheghathivhistha at gmail dot com
@ 2013-12-31 11:57 ` jakub at gcc dot gnu.org
  2013-12-31 12:12 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-31 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Dec 31 11:57:39 2013
New Revision: 206264

URL: http://gcc.gnu.org/viewcvs?rev=206264&root=gcc&view=rev
Log:
    PR tree-optimization/59622
    * gimple-fold.c (gimple_fold_call): Don't replace OBJ_TYPE_REF
    call fndecl with 0 possible targets with BUILT_IN_UNREACHABLE,
    instead only for !inplace add a __builtin_unreachable () call
    before the call.

    * g++.dg/opt/pr59622.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr59622.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (10 preceding siblings ...)
  2013-12-31 11:57 ` jakub at gcc dot gnu.org
@ 2013-12-31 12:12 ` jakub at gcc dot gnu.org
  2014-01-02 13:06 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-31 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ah, ok, the #c12 testcase is indeed a different case, targets doesn't have
length 0 in that case, but length 1, but targets[0]->decl is __cxa_pure_virtual
function, which is similar to __builtin_unreachable in that it takes no
arguments, has void return value and is noreturn.
So, supposedly for the length 1 case gimple_fold_call should compare if the
return type is compatible with the lhs type if it has lhs, for !inplace just
punt (similarly for the case (always?) when the number of arguments is bigger
than the called one), for inplace I guess we can replace it by a different call
but would need to do for the lhs what I mentioned (if it has lhs and the lhs
has gimple_reg_type, set it to zero after the noreturn call with void type).
For other incompatibilities in the return value or arguments, perhaps we should
just not try to fold it at all.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (11 preceding siblings ...)
  2013-12-31 12:12 ` jakub at gcc dot gnu.org
@ 2014-01-02 13:06 ` jakub at gcc dot gnu.org
  2014-01-02 17:01 ` hubicka at ucw dot cz
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-02 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 31561
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31561&action=edit
gcc49-pr59622-2.patch

So, do we want something like this?  For incompatible return type or argument
types punt, unless it is the __builtin_unreachable/__cxa_pure_virtual case
which can be handled the same, and similarly punt for inplace if the call flags
would change?


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (12 preceding siblings ...)
  2014-01-02 13:06 ` jakub at gcc dot gnu.org
@ 2014-01-02 17:01 ` hubicka at ucw dot cz
  2014-01-09 20:33 ` jakub at gcc dot gnu.org
  2014-01-09 21:01 ` jakub at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: hubicka at ucw dot cz @ 2014-01-02 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jan Hubicka <hubicka at ucw dot cz> ---
> So, do we want something like this?  For incompatible return type or argument
> types punt, unless it is the __builtin_unreachable/__cxa_pure_virtual case
> which can be handled the same, and similarly punt for inplace if the call flags
> would change?

Punting on methods with wrong return/parameter types seems resonable. We
probably
could/should warn here, since it almost definitely means ODR volation.
I would definitely try some code with warning on - type compatibility is
splipperly,
but testing in sense of useless_ssa_conversion should pass for all valid
programs.

Handling unreacahble/cxa_pure_virtual separately seems sane, too.

I am not too happy about giving up with inplace folding given that we forget to
fold statements later, but that is probably for indepenedent PR/patch.

So this approach is fine for me.  Thanks for looking into this!
Honza


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (13 preceding siblings ...)
  2014-01-02 17:01 ` hubicka at ucw dot cz
@ 2014-01-09 20:33 ` jakub at gcc dot gnu.org
  2014-01-09 21:01 ` jakub at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-09 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


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

* [Bug tree-optimization/59622] [4.9 Regression] internal compiler error: verify_gimple failed
  2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
                   ` (14 preceding siblings ...)
  2014-01-09 20:33 ` jakub at gcc dot gnu.org
@ 2014-01-09 21:01 ` jakub at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-09 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Thu Jan  9 20:09:33 2014
New Revision: 206492

URL: http://gcc.gnu.org/viewcvs?rev=206492&root=gcc&view=rev
Log:
    PR tree-optimization/59622
    * gimple-fold.c (gimple_fold_call): Fix a typo in message.  For
    __builtin_unreachable replace the OBJ_TYPE_REF call with a call to
    __builtin_unreachable and add if needed a setter of the lhs SSA_NAME.
    Don't devirtualize for inplace at all.  For targets.length () == 1,
    if the call is noreturn and cfun isn't in SSA form yet, clear lhs.

    * g++.dg/opt/pr59622-2.C: New test.
    * g++.dg/opt/pr59622-3.C: New test.
    * g++.dg/opt/pr59622-4.C: New test.
    * g++.dg/opt/pr59622-5.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr59622-2.C
    trunk/gcc/testsuite/g++.dg/opt/pr59622-3.C
    trunk/gcc/testsuite/g++.dg/opt/pr59622-4.C
    trunk/gcc/testsuite/g++.dg/opt/pr59622-5.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-01-09 20:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-29 16:46 [Bug other/59622] New: trung gcc-4.9.0:internal compiler error: verify_gimple failed nheghathivhistha at gmail dot com
2013-12-29 17:17 ` [Bug other/59622] [4.9 Regression] internal " glisse at gcc dot gnu.org
2013-12-29 18:12 ` trippels at gcc dot gnu.org
2013-12-30  7:39 ` trippels at gcc dot gnu.org
2013-12-30 10:16 ` jakub at gcc dot gnu.org
2013-12-30 10:49 ` [Bug tree-optimization/59622] " jakub at gcc dot gnu.org
2013-12-30 10:53 ` jakub at gcc dot gnu.org
2013-12-30 21:29 ` hubicka at gcc dot gnu.org
2013-12-30 21:33 ` hubicka at gcc dot gnu.org
2013-12-31  4:54 ` nheghathivhistha at gmail dot com
2013-12-31  7:47 ` nheghathivhistha at gmail dot com
2013-12-31 11:57 ` jakub at gcc dot gnu.org
2013-12-31 12:12 ` jakub at gcc dot gnu.org
2014-01-02 13:06 ` jakub at gcc dot gnu.org
2014-01-02 17:01 ` hubicka at ucw dot cz
2014-01-09 20:33 ` jakub at gcc dot gnu.org
2014-01-09 21:01 ` jakub 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).