diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-12-04 22:57:20 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2013-12-04 22:57:20 +0000 |
commit | 296674dbc9842ac009f558390da2bf6e5a9d4409 (patch) | |
tree | 1d857f76a0338447e2abb6b4d8b9d3a69458fff2 /gcc/c | |
parent | 31e071aeb827f49ce2e891620852198e99d44a0c (diff) | |
download | gcc-296674dbc9842ac009f558390da2bf6e5a9d4409.zip gcc-296674dbc9842ac009f558390da2bf6e5a9d4409.tar.gz gcc-296674dbc9842ac009f558390da2bf6e5a9d4409.tar.bz2 |
re PR c/52023 ([C11] _Alignof (double) yields wrong value on x86)
PR c/52023
c-family:
* c-common.c (c_sizeof_or_alignof_type): Add parameter min_alignof
and check field alignment if set.
* c-common.h (c_sizeof_or_alignof_type): Update prototype.
(c_sizeof, c_alignof): Update calls to c_sizeof_or_alignof_type.
c:
* c-parser.c (c_parser_alignas_specifier): Use
c_sizeof_or_alignof_type instead of c_alignof.
(c_parser_alignof_expression): Likewise, with min_alignof
parameter depending on alignof spelling used.
cp:
* typeck.c (cxx_sizeof_or_alignof_type): Update call to
c_sizeof_or_alignof_type.
objc:
* objc-act.c (objc_synthesize_getter): Update calls to
c_sizeof_or_alignof_type.
testsuite:
* gcc.dg/c11-align-6.c: New test.
From-SVN: r205685
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 0603852..4f353e8 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2013-12-04 Joseph Myers <joseph@codesourcery.com> + + PR c/52023 + * c-parser.c (c_parser_alignas_specifier): Use + c_sizeof_or_alignof_type instead of c_alignof. + (c_parser_alignof_expression): Likewise, with min_alignof + parameter depending on alignof spelling used. + 2013-12-04 Marek Polacek <polacek@redhat.com> PR c/54113 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 141c4ce..c78d269 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -3045,7 +3045,8 @@ c_parser_alignas_specifier (c_parser * parser) { struct c_type_name *type = c_parser_type_name (parser); if (type != NULL) - ret = c_alignof (loc, groktypename (type, NULL, NULL)); + ret = c_sizeof_or_alignof_type (loc, groktypename (type, NULL, NULL), + false, true, 1); } else ret = c_parser_expr_no_commas (parser, NULL).value; @@ -6446,11 +6447,12 @@ c_parser_alignof_expression (c_parser *parser) location_t loc = c_parser_peek_token (parser)->location; tree alignof_spelling = c_parser_peek_token (parser)->value; gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF)); + bool is_c11_alignof = strcmp (IDENTIFIER_POINTER (alignof_spelling), + "_Alignof") == 0; /* A diagnostic is not required for the use of this identifier in the implementation namespace; only diagnose it for the C11 spelling because of existing code using the other spellings. */ - if (!flag_isoc11 - && strcmp (IDENTIFIER_POINTER (alignof_spelling), "_Alignof") == 0) + if (!flag_isoc11 && is_c11_alignof) { if (flag_isoc99) pedwarn (loc, OPT_Wpedantic, "ISO C99 does not support %qE", @@ -6494,7 +6496,9 @@ c_parser_alignof_expression (c_parser *parser) /* alignof ( type-name ). */ c_inhibit_evaluation_warnings--; in_alignof--; - ret.value = c_alignof (loc, groktypename (type_name, NULL, NULL)); + ret.value = c_sizeof_or_alignof_type (loc, groktypename (type_name, + NULL, NULL), + false, is_c11_alignof, 1); ret.original_code = ERROR_MARK; ret.original_type = NULL; return ret; |