[PATCH] Fix wrong code with truncated string literals (PR 86711/86714)

Bernd Edlinger bernd.edlinger@hotmail.de
Sun Jul 29 10:56:00 GMT 2018


Hi!

This fixes two wrong code bugs where string_constant
returns over length string constants.  Initializers
like that are rejected in C++, but valid in C.

I have xfailed strlenopt-49.c, which tests this feature.
Personally I don't think that it is worth the effort to
optimize something that is per se invalid in C++.

The hunk in builtins.c is unrelated, but I would like
to use tree_to_shwi here, to be in line with the
tree_fits_shwi_p check above, and the rest of that
function which uses signed HWI throughout.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: changelog-pr86711.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180729/58b53488/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-pr86711.diff
Type: text/x-patch
Size: 7563 bytes
Desc: patch-pr86711.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180729/58b53488/attachment.bin>


More information about the Gcc-patches mailing list