Commit 7028c217 by Martin Sebor Committed by Martin Sebor

strlenopt-66.c: Avoid buffer overflow.

gcc/testsuite/ChangeLog:
	* gcc.dg/strlenopt-66.c: Avoid buffer overflow.  Add more test cases.

From-SVN: r278608
parent fb654309
2019-11-21 Martin Sebor <msebor@redhat.com>
* gcc.dg/strlenopt-66.c: Avoid buffer overflow. Add more test cases.
2019-11-21 Joseph Myers <joseph@codesourcery.com> 2019-11-21 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/c2x-attr-fallthrough-6.c: New test. Split out from * gcc.dg/c2x-attr-fallthrough-6.c: New test. Split out from
......
/* PRE tree-optimization/90626 - fold strcmp(a, b) == 0 to zero when /* PRE tree-optimization/90626 - fold strcmp(a, b) == 0 to zero when
one string length is exact and the other is unequal one string length is exact and the other is unequal
{ dg-do run } { dg-do run }
{ dg-options "-O2 -Wall -fdump-tree-optimized" } */ { dg-options "-O2 -Wall" } */
#include "strlenopt.h" #include "strlenopt.h"
...@@ -103,6 +103,12 @@ int main (void) ...@@ -103,6 +103,12 @@ int main (void)
test_strncmp_a4_cond_s5_s2_2 ("12", 0); test_strncmp_a4_cond_s5_s2_2 ("12", 0);
test_strncmp_a4_cond_a5_s2_5 ("12", "1234", 0); test_strncmp_a4_cond_a5_s2_5 ("12", "1234", 0);
test_strncmp_a4_cond_a5_a3_n ("12", "123", "1234", 0, 2); test_strncmp_a4_cond_a5_a3_n ("12", "1", "1", 0, 1);
test_strncmp_a4_cond_a5_a3_n ("123", "12", "12", 1, 3); test_strncmp_a4_cond_a5_a3_n ("", "1", "1234", 1, 1);
test_strncmp_a4_cond_a5_a3_n ("12", "12", "1", 0, 2);
test_strncmp_a4_cond_a5_a3_n ("", "12", "1234", 1, 2);
test_strncmp_a4_cond_a5_a3_n ("12", "123", "1", 0, 2);
test_strncmp_a4_cond_a5_a3_n ("", "123", "1234", 1, 3);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment