Created attachment 39717 [details] unreduced testcase Starting with r238559: commit 5157eff877f9491e7c0fc9231ac2b686983eaa41 Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Thu Jul 21 06:05:33 2016 +0000 PR c++/71121 - -Waddress, constexpr, and PMFs. * cp-gimplify.c (cp_fully_fold): First call maybe_constant_value. Kdevelop gets miscompiled and crashes on startup. I've narrowed the issue to a single file. See the attachments. x4 sublime # diff -u good_ bad_ --- good_ 2016-09-28 12:37:52.508094930 +0200 +++ bad_ 2016-09-28 14:24:11.674668521 +0200 @@ -1016,7 +1016,7 @@ pushq %r13 pushq %r12 pushq %rbx - subq $376, %rsp + subq $216, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 13, -40 @@ -1337,19 +1337,15 @@ movq 8(%rax), %rax movq %rax, -72(%rbp) movq -72(%rbp), %rax - movq (%rax), %rdx - movq _ZN7Sublime4Area9viewAddedEPNS_9AreaIndexEPNS_4ViewE@GOTPCREL(%rip), %rax - movq %rax, %r8 - movl $0, %r9d - movq %r8, %rax - cmpq %rax, %rdx + movq (%rax), %rax + testq %rax, %rax jne .L87 movq -72(%rbp), %rax movq 8(%rax), %rdx movq _ZN7Sublime4Area9viewAddedEPNS_9AreaIndexEPNS_4ViewE@GOTPCREL(%rip), %rax - movq %rax, %r10 - movl $0, %r11d - movq %r11, %rax + movq %rax, %r8 + movl $0, %r9d + movq %r9, %rax cmpq %rax, %rdx je .L88 movq -72(%rbp), %rax @@ -1362,19 +1358,15 @@ jmp .L55 .L87: movq -72(%rbp), %rax - movq (%rax), %rdx - movq _ZN7Sublime4Area17aboutToRemoveViewEPNS_9AreaIndexEPNS_4ViewE@GOTPCREL(%rip), %rax - movq %rax, %r12 - movl $0, %r13d - movq %r12, %rax - cmpq %rax, %rdx + movq (%rax), %rax + testq %rax, %rax jne .L89 movq -72(%rbp), %rax movq 8(%rax), %rdx movq _ZN7Sublime4Area17aboutToRemoveViewEPNS_9AreaIndexEPNS_4ViewE@GOTPCREL(%rip), %rax - movq %rax, %r14 - movl $0, %r15d - movq %r15, %rax + movq %rax, %r10 + movl $0, %r11d + movq %r11, %rax cmpq %rax, %rdx je .L90 movq -72(%rbp), %rax ...
Created attachment 39718 [details] good assembly
Created attachment 39719 [details] bad assembly
g++ -O0 -fPIC -c moc_area.ii -S -o bad_
markus@x4 tmp % cat moc.ii namespace Sublime { struct View; struct AreaIndex; struct Area { void qt_static_metacall(); void viewAdded(AreaIndex *, View *); }; } void Sublime::Area::qt_static_metacall() { typedef void (Area::*_t)(AreaIndex *, View *); if (*reinterpret_cast<_t *>(1) == _t(&Area::viewAdded)) __builtin_abort(); } gcc-6 -O3: Sublime::Area::qt_static_metacall(): cmpq Sublime::Area::viewAdded(Sublime::AreaIndex*, Sublime::View*), 1 je .L7 .L1: rep ret .L7: cmpq $0, 9 jne .L1 subq $8, %rsp call abort trunk -O3: Sublime::Area::qt_static_metacall(): cmpq $0, 1 je .L7 rep ret .L7: subq $8, %rsp call abort
;; Function void Sublime::Area::qt_static_metacall() (null) ;; enabled by -tree-original { typedef struct _t _t; if (1B->__pfn == ((struct _t) {.__pfn=viewAdded, .__delta=0}).__pfn && (1B->__delta == ((struct _t) {.__pfn=viewAdded, .__delta=0}).__delta || 1B->__pfn == 0B)) { <<cleanup_point <<< Unknown tree: expr_stmt __builtin_abort () >>>>>; } } vs. ;; Function void Sublime::Area::qt_static_metacall() (null) ;; enabled by -tree-original { typedef struct _t _t; if (1B->__pfn == 0B && (1B->__delta == ((struct _t) {.__pfn=viewAdded, .__delta=0}).__delta || 1B->__pfn == 0B)) { <<cleanup_point <<< Unknown tree: expr_stmt __builtin_abort () >>>>>; } } Jason?
Author: jason Date: Tue Oct 4 21:14:18 2016 New Revision: 240757 URL: https://gcc.gnu.org/viewcvs?rev=240757&root=gcc&view=rev Log: PR c++/77775 - misoptimization of PMF comparison * constexpr.c (cxx_eval_component_reference): Use name matching for PMFs. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-pmf1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c
Fixed.