This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ok for trunk, though generally looking at just next stmt is very fragile, might be better to look at the strncpy's vuse immediate uses if they are within the same basic block and either don't alias with it, or are the store it is looking for, or something similar.I guess some FOR_EACH_IMM_USE_FAST (...) { if (is_gimple_debug (USE_STMT (use_p))) continue; ... would be better.Jeff and I had a fairly extensive discussion about how best to handle debug statements. I had prototyped his suggestion along these lines but ran into false positives and other difficulties. The details are here: https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00805.html I thought I ended up just using gsi_next_nondebug() and added a test for it but I guess I must be misremembering. The patch review spanned a couple of months so it's even possible I forgot to make the change.
I looked though my hard drive for the test I remember writing for this. I couldn't find it but from memory here's roughly what it did: char d[3]; void f (const char *s) { int i; __builtin_strncpy (d, s, sizeof d); // false positive with -g i = 0; d[sizeof d - 1] = 0; } Martin
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |