diff options
author | Martin Liska <mliska@suse.cz> | 2017-10-11 14:31:59 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-10-11 12:31:59 +0000 |
commit | 3a266bcd811d8fdf3e9ad9134c40324aafa1bac9 (patch) | |
tree | 7723ddb415344c6081b7f90a395dec5c0f867a3e /gcc | |
parent | 050dcb6ad8de794e46d5eb377083fb8b9acf642e (diff) | |
download | gcc-3a266bcd811d8fdf3e9ad9134c40324aafa1bac9.zip gcc-3a266bcd811d8fdf3e9ad9134c40324aafa1bac9.tar.gz gcc-3a266bcd811d8fdf3e9ad9134c40324aafa1bac9.tar.bz2 |
Do not error for no_sanitize attributes (PR sanitizer/82490).
2017-10-11 Martin Liska <mliska@suse.cz>
PR sanitizer/82490
* opts.c (parse_no_sanitize_attribute): Do not use error_value
variable.
* opts.h (parse_no_sanitize_attribute): Remove last argument.
2017-10-11 Martin Liska <mliska@suse.cz>
PR sanitizer/82490
* c-attribs.c (handle_no_sanitize_attribute): Report directly
Wattributes warning.
2017-10-11 Martin Liska <mliska@suse.cz>
PR sanitizer/82490
* c-c++-common/ubsan/attrib-5.c: New test.
From-SVN: r253640
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-attribs.c | 9 | ||||
-rw-r--r-- | gcc/opts.c | 8 | ||||
-rw-r--r-- | gcc/opts.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/ubsan/attrib-5.c | 11 |
7 files changed, 35 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61ad754..7dba109 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2017-10-11 Martin Liska <mliska@suse.cz> + PR sanitizer/82490 + * opts.c (parse_no_sanitize_attribute): Do not use error_value + variable. + * opts.h (parse_no_sanitize_attribute): Remove last argument. + +2017-10-11 Martin Liska <mliska@suse.cz> + * print-rtl.c (print_insn): Move declaration of idbuf to same scope as name. diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index b636730..51e1b77 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-10-11 Martin Liska <mliska@suse.cz> + + PR sanitizer/82490 + * c-attribs.c (handle_no_sanitize_attribute): Report directly + Wattributes warning. + 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org> * c-ada-spec.c (dump_generic_ada_node): Use wi::to_wide when diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 4e6754f..bd8ca30 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -613,15 +613,8 @@ handle_no_sanitize_attribute (tree *node, tree name, tree args, int, return NULL_TREE; } - char *error_value = NULL; char *string = ASTRDUP (TREE_STRING_POINTER (id)); - unsigned int flags = parse_no_sanitize_attribute (string, &error_value); - - if (error_value) - { - error ("wrong argument: \"%s\"", error_value); - return NULL_TREE; - } + unsigned int flags = parse_no_sanitize_attribute (string); add_no_sanitize_value (*node, flags); @@ -1700,11 +1700,10 @@ parse_sanitizer_options (const char *p, location_t loc, int scode, } /* Parse string values of no_sanitize attribute passed in VALUE. - Values are separated with comma. Wrong argument is stored to - WRONG_ARGUMENT variable. */ + Values are separated with comma. */ unsigned int -parse_no_sanitize_attribute (char *value, char **wrong_argument) +parse_no_sanitize_attribute (char *value) { unsigned int flags = 0; unsigned int i; @@ -1722,7 +1721,8 @@ parse_no_sanitize_attribute (char *value, char **wrong_argument) } if (sanitizer_opts[i].name == NULL) - *wrong_argument = q; + warning (OPT_Wattributes, + "%<%s%> attribute directive ignored", q); q = strtok (NULL, ","); } @@ -390,7 +390,7 @@ extern void handle_common_deferred_options (void); unsigned int parse_sanitizer_options (const char *, location_t, int, unsigned int, int, bool); -unsigned int parse_no_sanitize_attribute (char *value, char **wrong_argument); +unsigned int parse_no_sanitize_attribute (char *value); extern bool common_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f51a72..04adb93 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2017-10-11 Martin Liska <mliska@suse.cz> + PR sanitizer/82490 + * c-c++-common/ubsan/attrib-5.c: New test. + +2017-10-11 Martin Liska <mliska@suse.cz> + Revert r253637: PR sanitizer/82484 diff --git a/gcc/testsuite/c-c++-common/ubsan/attrib-5.c b/gcc/testsuite/c-c++-common/ubsan/attrib-5.c new file mode 100644 index 0000000..fee1df1 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/attrib-5.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=undefined" } */ + +__attribute__((no_sanitize("foobar"))) +static void +float_cast2 (void) +{ /* { dg-warning "attribute directive ignored" } */ + volatile double d = 300; + volatile signed char c; + c = d; +} |