From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 453D5385BF81; Sat, 27 Jun 2020 18:22:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 453D5385BF81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593282163; bh=PoHoJ+UQxNSoVSTMct6aH/nD2RTiDJs5YAB0DM082IY=; h=From:To:Subject:Date:From; b=V4wC8PrMgaBiGOBxIfzZYwgRm+6hymUmxMgC0pCXIfYbv7ndO6RAisADBTyl+wII4 1PXlWBz+uxJGwUtRuGeg7lJF2R6RWnUMPZR/w34f1I0Ga41keCa28CvcclMS9+Hryv jlFn0aMpxGxT46pMQhvr7D54IFhhlhmKBw+qN9fs= From: "slyfox at inbox dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95942] New: [11 regression] offsetof on an array: error: 'e' is not a constant expression Date: Sat, 27 Jun 2020 18:22:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at inbox dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2020 18:22:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95942 Bug ID: 95942 Summary: [11 regression] offsetof on an array: error: 'e' is not a constant expression Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at inbox dot ru Target Milestone: --- The original error is seen on https://www.dolphin-emu.org/ project as a bui= ld error. Minimized example looks the following: """ // $ cat.bug.cc struct a { int b; char c[100]; }; unsigned long d(long e) { return __builtin_offsetof(a, c[e]); } """ OK: $ LANG=3DC g++-10.1.0 -c bug.cc -o bug.o OK: $ LANG=3DC clang++-10 -c bug.cc -o bug.o FAIL: $ LANG=3DC g++-11.0.0 -c bug.cc -o bug.o bug.cc: In function 'void d(long int)': bug.cc:8:42: error: 'e' is not a constant expression 8 | void d(long e) { __builtin_offsetof(a, c[e]); } | Who is wrong here? gcc-10 or gcc-11?=