diff options
author | Martin Sebor <msebor@redhat.com> | 2021-04-28 19:11:34 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-04-28 19:11:34 -0600 |
commit | 2c8bffa184dffba7976ba807ef0a1bbb6f66aa2d (patch) | |
tree | 337798e34868e1f8e21248cdbd8677261763bd26 /gcc/attribs.c | |
parent | 2de7c792569d7a227426aaeb124686a856614da7 (diff) | |
download | gcc-2c8bffa184dffba7976ba807ef0a1bbb6f66aa2d.zip gcc-2c8bffa184dffba7976ba807ef0a1bbb6f66aa2d.tar.gz gcc-2c8bffa184dffba7976ba807ef0a1bbb6f66aa2d.tar.bz2 |
PR middle-end/100250 - ICE related to -Wmaybe-uninitialized
gcc/ChangeLog:
PR middle-end/100250
* attribs.c (attr_access::array_as_string): Avoid dereferencing
a pointer when it's null.
gcc/testsuite/ChangeLog:
PR middle-end/100250
* gcc.dg/uninit-pr100250.c: New test.
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index 3ffa1b6..ebc0783 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -2388,7 +2388,8 @@ attr_access::array_as_string (tree type) const const char *p = end; for ( ; p != str && *p-- != ']'; ); if (*p == '$') - index_type = build_index_type (TREE_VALUE (size)); + /* SIZE may have been cleared. Use it with care. */ + index_type = build_index_type (size ? TREE_VALUE (size) : size); } else if (minsize) index_type = build_index_type (size_int (minsize - 1)); |