Created attachment 45186 [details] Preprocessed source to reproduce error I've got ../../runtime/vm/raw_object_fields.cc:218:1: internal compiler error: output_operand: invalid expression as operand when trying to build https://github.com/dart-lang/sdk Preprocessed source is attached. Build command is: g++ -MMD -MF x86/obj/runtime/vm/libdart_vm_nosnapshot_with_precompiler.raw_object_fields.o.d -D_FORTIFY_SOURCE=2 -DNDEBUG -DTARGET_ARCH_ARM -DTARGET_ARCH_ARM_6 -DNDEBUG -DDART_USE_TCMALLOC -DTARGET_OS_LINUX -DDART_NO_SNAPSHOT -DDART_PRECOMPILER -I../../runtime -I../.. -Ix86/gen -I../../runtime/include -I../../third_party/tcmalloc/gperftools/src -m32 -msse2 -mfpmath=sse -fno-exceptions -pthread -Wendif-labels -Wno-missing-field-initializers -Wno-unused-parameter -fdebug-prefix-map=/home/lorca/dart/sdk=../.. -no-canonical-prefixes -O3 -fno-ident -fdata-sections -ffunction-sections -g3 -ggdb3 -Wno-unused-parameter -Wnon-virtual-dtor -Wvla -Wno-conversion-null -Woverloaded-virtual -Wno-comments -g3 -ggdb3 -fno-rtti -fno-exceptions -O3 -fvisibility-inlines-hidden -fno-omit-frame-pointer -std=gnu++11 -fno-rtti -fno-exceptions -c preprocessed.cc Reproduces on gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1) and gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
Reduced testcase: typedef __UINTPTR_TYPE__ uintptr_t; const uintptr_t a = 2; struct C { int b; }; uintptr_t c { uintptr_t (&reinterpret_cast<C *>(a)->b) }; Started with my r259458.
Created attachment 45190 [details] gcc9-pr88410.patch Untested fix. Why doesn't libdart use offsetof though?
Author: jakub Date: Mon Dec 17 21:54:37 2018 New Revision: 267220 URL: https://gcc.gnu.org/viewcvs?rev=267220&root=gcc&view=rev Log: PR c++/88410 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding, call maybe_constant_value on val to see if it is INTEGER_CST. * g++.dg/cpp0x/pr88410.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr88410.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-gimplify.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk so far.
Author: jakub Date: Tue Jan 8 10:22:44 2019 New Revision: 267710 URL: https://gcc.gnu.org/viewcvs?rev=267710&root=gcc&view=rev Log: Backported from mainline 2018-12-17 Jakub Jelinek <jakub@redhat.com> PR c++/88410 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding, call maybe_constant_value on val to see if it is INTEGER_CST. * g++.dg/cpp0x/pr88410.C: New test. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/pr88410.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/cp-gimplify.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
Fixed for 8.3+ too.