Bug 61065 - [4.9/4.10 Regresion] invalid args to -fsanitize should be an error not a warning
Summary: [4.9/4.10 Regresion] invalid args to -fsanitize should be an error not a warning
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 4.8.3
: P3 normal
Target Milestone: 4.9.1
Assignee: Marek Polacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-05 12:57 UTC by Matthias Klose
Modified: 2014-05-05 20:41 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.8.2
Known to fail: 4.10.0, 4.9.0
Last reconfirmed: 2014-05-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2014-05-05 12:57:32 UTC
[forwarded from https://bugs.debian.org/745105]

With gcc-4.8 this works because -fsanitize=address works in 4.8:

    > gcc-4.8 -fsanitize=address test.c -o /dev/null

and this fails and exits with non-zero because -fsanitize=integer
is not supported in 4.8:

    > gcc-4.8 -fsanitize=integer test.c -o /dev/null
    gcc-4.8: error: unrecognized command line option ‘-fsanitize=integer’
    > echo $?
    1

Now for 4.9:

    > gcc-4.9 -fsanitize=integer test.c -o /dev/null
    gcc-4.9: warning: unrecognized argument to -fsanitize= option: ‘integer’
    cc1: warning: unrecognized argument to -fsanitize= option: ‘integer’
    > echo $?
    0

This should exit with non-zero so that support for this flag can correctly
be detected in things line autoconf generated configure scripts.
Comment 1 Marek Polacek 2014-05-05 13:03:09 UTC
Patch:

--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1495,9 +1495,9 @@ common_handle_option (struct gcc_options *opts,
                }
 
            if (! found)
-             warning_at (loc, 0,
-                         "unrecognized argument to -fsanitize= option: %q.*s",
-                         (int) len, p);
+             error_at (loc,
+                       "unrecognized argument to -fsanitize= option: %q.*s",
+                       (int) len, p);
 
            if (comma == NULL)
              break;
Comment 2 Marek Polacek 2014-05-05 20:38:18 UTC
Author: mpolacek
Date: Mon May  5 20:37:47 2014
New Revision: 210080

URL: http://gcc.gnu.org/viewcvs?rev=210080&root=gcc&view=rev
Log:
	PR driver/61065
	* opts.c (common_handle_option): Call error_at instead of warning_at.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/opts.c
Comment 3 Marek Polacek 2014-05-05 20:41:05 UTC
Author: mpolacek
Date: Mon May  5 20:40:33 2014
New Revision: 210081

URL: http://gcc.gnu.org/viewcvs?rev=210081&root=gcc&view=rev
Log:
	PR driver/61065
	* opts.c (common_handle_option): Call error_at instead of warning_at.

Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/opts.c
Comment 4 Marek Polacek 2014-05-05 20:41:31 UTC
Fixed.