diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-01-30 19:19:40 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-01-30 19:19:40 +0000 |
commit | e9770d5120e4f26b56d820ceb363497e3c724297 (patch) | |
tree | d8f79081ba49b8c1fd91e83b95f8c1ca69877c3e /gcc | |
parent | d966ae60665c7dbe90121db5304b4328feb0eb04 (diff) | |
download | gcc-e9770d5120e4f26b56d820ceb363497e3c724297.zip gcc-e9770d5120e4f26b56d820ceb363497e3c724297.tar.gz gcc-e9770d5120e4f26b56d820ceb363497e3c724297.tar.bz2 |
c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type) is not NULL.
* c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type)
is not NULL.
* toplev.c (decode_W_option): Update warn_larger_than
unconditionally for each processed switch.
* testsuite/gcc.dg/Wlarger-than.c: New test.
From-SVN: r39352
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wlarger-than.c | 10 | ||||
-rw-r--r-- | gcc/toplev.c | 3 |
5 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f5a437..407065b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-01-30 Neil Booth <neil@daikokuya.demon.co.uk> + + * c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type) + is not NULL. + * toplev.c (decode_W_option): Update warn_larger_than + unconditionally for each processed switch. + 2001-01-30 John David Anglin <dave@hiauly1.hia.nrc.ca> * pa.c (pa_init_machine_status): Initialize pic_offset_table_save_rtx diff --git a/gcc/c-decl.c b/gcc/c-decl.c index d5558db..edbe9ce 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6728,7 +6728,8 @@ c_expand_body (fndecl, nested_p) { tree ret_type = TREE_TYPE (TREE_TYPE (fndecl)); - if (ret_type && TREE_CODE (TYPE_SIZE_UNIT (ret_type)) == INTEGER_CST + if (ret_type && TYPE_SIZE_UNIT (ret_type) + && TREE_CODE (TYPE_SIZE_UNIT (ret_type)) == INTEGER_CST && 0 < compare_tree_int (TYPE_SIZE_UNIT (ret_type), larger_than_size)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index abf39f9..a8fd1d3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-01-30 Neil Booth <neil@daikokuya.demon.co.uk> + + * gcc.dg/Wlarger-than.c: New test. + 2001-01-29 Neil Booth <neil@daikokuya.demon.co.uk> * gcc.dg/cpp/avoidpaste1.c: Fix typos. diff --git a/gcc/testsuite/gcc.dg/Wlarger-than.c b/gcc/testsuite/gcc.dg/Wlarger-than.c new file mode 100644 index 0000000..609a7ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wlarger-than.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wlarger-than-32768" } */ + +/* -Wlarger-than with functions returning void used to segfault. + Source: PR 602, testsuite-ized by Neil Booth 21 Jan 2000. */ + +static void foo (void) {} + diff --git a/gcc/toplev.c b/gcc/toplev.c index d29d6c0..64b9bc3 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4170,8 +4170,7 @@ decode_W_option (arg) { larger_than_size = read_integral_parameter (option_value, arg - 2, -1); - if (larger_than_size != -1) - warn_larger_than = 1; + warn_larger_than = larger_than_size != -1; } else if (!strcmp (arg, "unused")) { |