[Bug c++/85061] ICE with __builtin_offsetof applied to static member

2018-03-28 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85061

Volker Reichelt  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Volker Reichelt  ---
Fixed by Jakub's patch.

[Bug c++/85061] ICE with __builtin_offsetof applied to static member

2018-03-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85061

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Tue Mar 27 19:59:30 2018
New Revision: 258902

URL: https://gcc.gnu.org/viewcvs?rev=258902&root=gcc&view=rev
Log:
PR c++/85061
* c-common.c (fold_offsetof_1) : Assert that
get_base_address of the second operand is a VAR_P, rather than the
operand itself, and use gcc_checking_assert instead of gcc_assert.

* g++.dg/ext/builtin-offsetof3.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/ext/builtin-offsetof3.C
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/85061] ICE with __builtin_offsetof applied to static member

2018-03-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85061

--- Comment #2 from Jakub Jelinek  ---
Created attachment 43757
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43757&action=edit
gcc8-pr85061.patch

Untested fix.

[Bug c++/85061] ICE with __builtin_offsetof applied to static member

2018-03-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85061

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-03-24
 CC||jakub at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
--- gcc/c-family/c-common.c.jj  2018-03-13 00:38:23.809662252 +0100
+++ gcc/c-family/c-common.c 2018-03-24 15:21:36.171485128 +0100
@@ -6272,7 +6272,7 @@ fold_offsetof_1 (tree expr, enum tree_co
 case COMPOUND_EXPR:
   /* Handle static members of volatile structs.  */
   t = TREE_OPERAND (expr, 1);
-  gcc_assert (VAR_P (t));
+  gcc_checking_assert (VAR_P (get_base_address (t)));
   return fold_offsetof_1 (t);

 default:

seems to fix this.