byte_offset_t *out_bytes_read,
logger *logger)
{
+ if (bytes.m_start_byte_offset == 0
+ && sval->all_zeroes_p ())
+ {
+ /* The initial byte of an all-zeroes SVAL is a zero byte. */
+ *out_bytes_read = 1;
+ return tristate (true);
+ }
+
switch (sval->get_kind ())
{
case SK_CONSTANT:
return tristate::TS_UNKNOWN;
default:
- gcc_unreachable ();
break;
}
}
--- /dev/null
+#include "analyzer-decls.h"
+
+typedef int __attribute__((__vector_size__ (32))) V;
+
+typedef __SIZE_TYPE__ size_t;
+
+static size_t __attribute__((noinline))
+call_strlen (const char *p)
+{
+ return __builtin_strlen (p);
+}
+
+void
+foo (void *out)
+{
+ V v = (V) { };
+ __analyzer_eval (call_strlen ((const char *)&v) == 0); /* { dg-warning "TRUE" } */
+}
__analyzer_eval (dst[4] == '\0'); /* { dg-warning "TRUE" "correct" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (__analyzer_get_strlen (dst) == 0); /* { dg-warning "TRUE" } */
- __analyzer_eval (__analyzer_get_strlen (dst + 1) == 0); /* { dg-warning "TRUE" "correct" { xfail *-*-* } } */
- /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
+ __analyzer_eval (__analyzer_get_strlen (dst + 1) == 0); /* { dg-warning "TRUE" } */
}
char *test_unterminated_concrete_a (char *dst)
--- /dev/null
+typedef int __attribute__((__vector_size__ (32))) V;
+
+void
+foo (char *out)
+{
+ V v = (V) { };
+ __builtin_strncpy (out, (char *)&v, 5);
+}