@@ -607,7 +607,8 @@ maybe_warn_nonstring_arg (tree fndecl, GimpleOrTree exp)
{
if (tree arrbnd = TYPE_DOMAIN (type))
{
- if ((arrbnd = TYPE_MAX_VALUE (arrbnd)))
+ if ((arrbnd = TYPE_MAX_VALUE (arrbnd))
+ && TREE_CODE (arrbnd) == INTEGER_CST)
{
asize = wi::to_offset (arrbnd) + 1;
known_size = true;
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int g;
+void e(int s) {
+ struct {
+ __attribute__((nonstring)) char bn[g];
+ } f;
+ __builtin_strncpy (f.bn, f.bn, s);
+}