diff options
author | Siddhesh Poyarekar <siddhesh@gotplt.org> | 2021-11-15 23:03:14 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@gotplt.org> | 2021-11-16 04:20:31 +0530 |
commit | cea4dab861bae6536dd5655a42d73f2c17f655f7 (patch) | |
tree | 205fe929f25b0dc3b051f1f72a11b3e71bf101e3 /gcc/omp-expand.c | |
parent | d1753b4be981fcb176f56b6ed45f7dbe1177d641 (diff) | |
download | gcc-cea4dab861bae6536dd5655a42d73f2c17f655f7.zip gcc-cea4dab861bae6536dd5655a42d73f2c17f655f7.tar.gz gcc-cea4dab861bae6536dd5655a42d73f2c17f655f7.tar.bz2 |
gimple-fold: Use ranges to simplify _chk calls
Instead of comparing LEN and SIZE only if they are constants, use their
ranges to decide if LEN will always be lower than or same as SIZE.
This change ends up putting the stringop-overflow warning line number
against the strcpy implementation, so adjust the warning check to be
line number agnostic.
gcc/ChangeLog:
* gimple-fold.c (known_lower): New function.
(gimple_fold_builtin_strncat_chk,
gimple_fold_builtin_memory_chk, gimple_fold_builtin_stxcpy_chk,
gimple_fold_builtin_stxncpy_chk,
gimple_fold_builtin_snprintf_chk,
gimple_fold_builtin_sprintf_chk): Use it.
gcc/testsuite/ChangeLog:
* gcc.dg/Wobjsize-1.c: Make warning change line agnostic.
* gcc.dg/fold-stringops-2.c: New test.
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Diffstat (limited to 'gcc/omp-expand.c')
0 files changed, 0 insertions, 0 deletions