diff options
author | Martin Sebor <msebor@redhat.com> | 2021-06-04 10:49:06 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-06-04 10:49:39 -0600 |
commit | 9816f509db4966fcb90ed3baab72cc6cd901f06c (patch) | |
tree | abb2a4e7b5c79a640dc41d6d2b413b8963a37b06 /gcc/tree-ssa-uninit.c | |
parent | c6503fa93b5565c922f76611a55b0a53cd940a5f (diff) | |
download | gcc-9816f509db4966fcb90ed3baab72cc6cd901f06c.zip gcc-9816f509db4966fcb90ed3baab72cc6cd901f06c.tar.gz gcc-9816f509db4966fcb90ed3baab72cc6cd901f06c.tar.bz2 |
PR middle-end/100732 - ICE on sprintf %s with integer argument
gcc/ChangeLog:
PR middle-end/100732
* gimple-fold.c (gimple_fold_builtin_sprintf): Avoid folding calls
with either source or destination argument of invalid type.
* tree-ssa-uninit.c (maybe_warn_pass_by_reference): Avoid checking
calls with arguments of invalid type.
gcc/testsuite/ChangeLog:
PR middle-end/100732
* gcc.dg/tree-ssa/builtin-snprintf-11.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-12.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-28.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-29.c: New test.
* gcc.dg/uninit-pr100732.c: New test.
Diffstat (limited to 'gcc/tree-ssa-uninit.c')
-rw-r--r-- | gcc/tree-ssa-uninit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index dcfdec9..7c002f8 100644 --- a/gcc/tree-ssa-uninit.c +++ b/gcc/tree-ssa-uninit.c @@ -541,6 +541,9 @@ maybe_warn_pass_by_reference (gcall *stmt, wlimits &wlims) continue; tree arg = gimple_call_arg (stmt, argno - 1); + if (!POINTER_TYPE_P (TREE_TYPE (arg))) + /* Avoid actual arguments with invalid types. */ + continue; ao_ref ref; ao_ref_init_from_ptr_and_size (&ref, arg, access_size); |