]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fix typo in attr_fnspec::verify
authorAlexandre Oliva <oliva@adacore.com>
Wed, 14 Jul 2021 16:03:23 +0000 (13:03 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Wed, 14 Jul 2021 16:03:23 +0000 (13:03 -0300)
Odd-numbered indices describing argument access sizes in the fnspec
string can only hold 't' or a digit, as tested in the beginning of the
case.  When checking that the size-supplying argument does not have
additional information associated with it, the test that excludes the
't' possibility looks for it at the even position in the fnspec
string.  Oops.

This might yield false positives and negatives if a function has a
fnspec in which an argument uses a 't' access-size, and ('t' - '1')
happens to be the index of an argument described in an fnspec string.
Assuming ASCII encoding, it would take a function with at least 68
arguments described in fnspec.  Still, probably worth fixing.

for  gcc/ChangeLog

* tree-ssa-alias.c (attr_fnspec::verify): Fix index in
non-'t'-sized arg check.

(cherry picked from commit a7098d6ef4e4e799dab8ef925c62b199d707694b)

gcc/tree-ssa-alias.c

index ebb3f49c86c66501d3d8fff87df85c6cbcab3558..3e578e5d05f49edbeca48b9e221bcc36f6f93999 100644 (file)
@@ -3868,7 +3868,7 @@ attr_fnspec::verify ()
                    && str[idx] != 'w' && str[idx] != 'W'
                    && str[idx] != 'o' && str[idx] != 'O')
                  err = true;
-               if (str[idx] != 't'
+               if (str[idx + 1] != 't'
                    /* Size specified is scalar, so it should be described
                       by ". " if specified at all.  */
                    && (arg_specified_p (str[idx + 1] - '1')