[PATCH] Fix pdftex miscompilation due to get_range_strlen (PR tree-optimization/84478)

Martin Sebor msebor@gmail.com
Tue Feb 20 23:59:00 GMT 2018


> It would help if you explained why you think it is a good idea
> ignoring the other phi arguments if you have one (or more) where you can
> determine length.

It's a heuristic that was meant just for the -Wformat-overflow
warning.  When making decisions that affect code generation it's
obviously not correct to ignore the possibility that unknown
arguments may be shorter than the minimum or longer than
the maximum.  The fuzzy argument was meant to differentiate
between two got but I forgot about it when I added the fix
for PR 83671.

For GCC 8 I don't have a preference for how to fix this as long
as it doesn't regress the warning tests.

I think the ultimate solution (for GCC 9) may be to either
disable the heuristic for code generation purposes (e.g., via
another argument/flag) or provide a pointer argument to indicate
to the caller that the minimum is based on known strings, and that
the real minimum may be zero.

Martin



More information about the Gcc-patches mailing list