diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-03-27 21:59:30 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-03-27 21:59:30 +0200 |
commit | a7dea61705009a47b788ecafed0816ab8b54e3ac (patch) | |
tree | e568e6d24afab9b357d90af7039d5096786da049 /gcc/c-family | |
parent | dc442cef60468a813ab2abee691280089a5e5b7f (diff) | |
download | gcc-a7dea61705009a47b788ecafed0816ab8b54e3ac.zip gcc-a7dea61705009a47b788ecafed0816ab8b54e3ac.tar.gz gcc-a7dea61705009a47b788ecafed0816ab8b54e3ac.tar.bz2 |
re PR c++/85061 (ICE with __builtin_offsetof applied to static member)
PR c++/85061
* c-common.c (fold_offsetof_1) <case COMPOUND_EXPR>: 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.
From-SVN: r258902
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index f728311..e3558d7 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2018-03-27 Jakub Jelinek <jakub@redhat.com> + + PR c++/85061 + * c-common.c (fold_offsetof_1) <case COMPOUND_EXPR>: 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. + 2018-03-23 Marek Polacek <polacek@redhat.com> PR c++/85045 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index e1df1d3..7e6905e 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6272,7 +6272,7 @@ fold_offsetof_1 (tree expr, enum tree_code ctx) 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: |