mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-23 01:30:29 +08:00
re PR c/82167 (Segmentation fault when dereferencing the address of an array argument)
PR c/82167 * c-typeck.c (c_expr_sizeof_expr): Use the type of expr.value rather than expr.original_type. * gcc.dg/pr82167.c: New test. From-SVN: r252372
This commit is contained in:
parent
72ace300a2
commit
267bbb6fd1
@ -1,3 +1,9 @@
|
||||
2017-09-13 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/82167
|
||||
* c-typeck.c (c_expr_sizeof_expr): Use the type of expr.value rather
|
||||
than expr.original_type.
|
||||
|
||||
2017-09-12 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* c-decl.c (field_decl_cmp, resort_data, resort_field_decl_cmp,
|
||||
|
@ -2909,7 +2909,7 @@ c_expr_sizeof_expr (location_t loc, struct c_expr expr)
|
||||
if (warning_at (loc, OPT_Wsizeof_array_argument,
|
||||
"%<sizeof%> on array function parameter %qE will "
|
||||
"return size of %qT", expr.value,
|
||||
expr.original_type))
|
||||
TREE_TYPE (expr.value)))
|
||||
inform (DECL_SOURCE_LOCATION (expr.value), "declared here");
|
||||
}
|
||||
tree folded_expr = c_fully_fold (expr.value, require_constant_value,
|
||||
|
@ -1,3 +1,8 @@
|
||||
2017-09-13 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/82167
|
||||
* gcc.dg/pr82167.c: New test.
|
||||
|
||||
2017-09-13 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* gcc.target/powerpc/fold-vec-ld-char.c: New.
|
||||
|
14
gcc/testsuite/gcc.dg/pr82167.c
Normal file
14
gcc/testsuite/gcc.dg/pr82167.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* PR c/82167 */
|
||||
/* { dg-do compile } */
|
||||
|
||||
void
|
||||
fn1 (int a[])
|
||||
{
|
||||
__builtin_printf ("%zu\n", sizeof (*&a)); /* { dg-warning ".sizeof. on array function parameter .a. will return size of .int \\*." } */
|
||||
}
|
||||
|
||||
void
|
||||
fn2 (int *a[])
|
||||
{
|
||||
__builtin_printf ("%zu\n", sizeof (*&a)); /* { dg-warning ".sizeof. on array function parameter .a. will return size of .int \\*\\*." } */
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user