lint: reword messages about array subscripts to sound more natural
This commit is contained in:
parent
4e13543e2b
commit
c6466ed0f7
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: d_c99_init.c,v 1.47 2024/01/28 08:17:27 rillig Exp $ */
|
/* $NetBSD: d_c99_init.c,v 1.48 2024/03/30 16:47:45 rillig Exp $ */
|
||||||
# 3 "d_c99_init.c"
|
# 3 "d_c99_init.c"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -238,11 +238,11 @@ struct geometry geometry = {
|
||||||
.pentagons[0].points[4].x = 1,
|
.pentagons[0].points[4].x = 1,
|
||||||
.points[0][0][0] = { 0, 0 },
|
.points[0][0][0] = { 0, 0 },
|
||||||
.points[2][4][1] = {301, 302 },
|
.points[2][4][1] = {301, 302 },
|
||||||
/* expect+1: error: array subscript cannot be > 2: 3 [168] */
|
/* expect+1: error: array subscript 3 cannot be > 2 [168] */
|
||||||
.points[3][0][0] = {3001, 3002 },
|
.points[3][0][0] = {3001, 3002 },
|
||||||
/* expect+1: error: array subscript cannot be > 4: 5 [168] */
|
/* expect+1: error: array subscript 5 cannot be > 4 [168] */
|
||||||
.points[0][5][0] = {501, 502 },
|
.points[0][5][0] = {501, 502 },
|
||||||
/* expect+1: error: array subscript cannot be > 1: 2 [168] */
|
/* expect+1: error: array subscript 2 cannot be > 1 [168] */
|
||||||
.points[0][0][2] = {21, 22 },
|
.points[0][0][2] = {21, 22 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* $NetBSD: msg_167.c,v 1.6 2024/03/27 19:28:20 rillig Exp $ */
|
/* $NetBSD: msg_167.c,v 1.7 2024/03/30 16:47:45 rillig Exp $ */
|
||||||
# 3 "msg_167.c"
|
# 3 "msg_167.c"
|
||||||
|
|
||||||
// Test for message: array subscript cannot be negative: %jd [167]
|
// Test for message: array subscript %jd cannot be negative [167]
|
||||||
|
|
||||||
/* lint1-extra-flags: -X 351 */
|
/* lint1-extra-flags: -X 351 */
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ example(int *ptr)
|
||||||
{
|
{
|
||||||
int arr[6];
|
int arr[6];
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be negative: -3 [167] */
|
/* expect+1: warning: array subscript -3 cannot be negative [167] */
|
||||||
arr[-3] = 13;
|
arr[-3] = 13;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* $NetBSD: msg_168.c,v 1.11 2024/03/27 19:28:20 rillig Exp $ */
|
/* $NetBSD: msg_168.c,v 1.12 2024/03/30 16:47:45 rillig Exp $ */
|
||||||
# 3 "msg_168.c"
|
# 3 "msg_168.c"
|
||||||
|
|
||||||
// Test for message: array subscript cannot be > %d: %jd [168]
|
// Test for message: array subscript %jd cannot be > %d [168]
|
||||||
|
|
||||||
/* lint1-extra-flags: -X 351 */
|
/* lint1-extra-flags: -X 351 */
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ example(void)
|
||||||
print_string(buf + 21); /* undefined behavior, not detected */
|
print_string(buf + 21); /* undefined behavior, not detected */
|
||||||
|
|
||||||
print_char(buf[19]);
|
print_char(buf[19]);
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 20 [168] */
|
/* expect+1: warning: array subscript 20 cannot be > 19 [168] */
|
||||||
print_char(buf[20]);
|
print_char(buf[20]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ array_with_c99_initializer(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
print_string(to_roman['9']);
|
print_string(to_roman['9']);
|
||||||
/* expect+1: warning: array subscript cannot be > 57: 58 [168] */
|
/* expect+1: warning: array subscript 58 cannot be > 57 [168] */
|
||||||
print_string(to_roman[':']);
|
print_string(to_roman[':']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: platform_ilp32_int.c,v 1.6 2024/03/10 19:45:14 rillig Exp $ */
|
/* $NetBSD: platform_ilp32_int.c,v 1.7 2024/03/30 16:47:45 rillig Exp $ */
|
||||||
# 3 "platform_ilp32_int.c"
|
# 3 "platform_ilp32_int.c"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -37,69 +37,69 @@ void
|
||||||
array_index(void)
|
array_index(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */
|
/* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x00ffffff];
|
u8 += u8_buf[0x00ffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */
|
/* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x7fffffff];
|
u8 += u8_buf[0x7fffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */
|
/* expect+1: warning: array subscript -2147483648 cannot be negative [167] */
|
||||||
u8 += u8_buf[2147483648];
|
u8 += u8_buf[2147483648];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */
|
/* expect+1: warning: array subscript -2147483648 cannot be negative [167] */
|
||||||
u8 += u8_buf[0x80000000];
|
u8 += u8_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffff];
|
u8 += u8_buf[0xffffffff];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */
|
/* expect+1: warning: array subscript -2147483648 cannot be negative [167] */
|
||||||
u8 += u8_buf[0x80000000];
|
u8 += u8_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffff];
|
u8 += u8_buf[0xffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0x00ffffffffffffff];
|
u8 += u8_buf[0x00ffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffffffffffff];
|
u8 += u8_buf[0xffffffffffffffff];
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */
|
/* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x00ffffff];
|
u64 += u64_buf[0x00ffffff];
|
||||||
/* expect+2: warning: '2147483647 * 8' overflows 'int' [141] */
|
/* expect+2: warning: '2147483647 * 8' overflows 'int' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 268435455 [168] */
|
/* expect+1: warning: array subscript 268435455 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x7fffffff];
|
u64 += u64_buf[0x7fffffff];
|
||||||
/* expect+3: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+3: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */
|
/* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -268435456 [167] */
|
/* expect+1: warning: array subscript -268435456 cannot be negative [167] */
|
||||||
u64 += u64_buf[2147483648];
|
u64 += u64_buf[2147483648];
|
||||||
/* expect+3: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+3: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */
|
/* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -268435456 [167] */
|
/* expect+1: warning: array subscript -268435456 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x80000000];
|
u64 += u64_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffff];
|
u64 += u64_buf[0xffffffff];
|
||||||
/* expect+3: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+3: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */
|
/* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -268435456 [167] */
|
/* expect+1: warning: array subscript -268435456 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x80000000];
|
u64 += u64_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffff];
|
u64 += u64_buf[0xffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x00ffffffffffffff];
|
u64 += u64_buf[0x00ffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x0fffffffffffffff];
|
u64 += u64_buf[0x0fffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x1fffffffffffffff];
|
u64 += u64_buf[0x1fffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x3fffffffffffffff];
|
u64 += u64_buf[0x3fffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x7fffffffffffffff];
|
u64 += u64_buf[0x7fffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffffffffffff];
|
u64 += u64_buf[0xffffffffffffffff];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: platform_ilp32_long.c,v 1.8 2024/03/10 19:45:14 rillig Exp $ */
|
/* $NetBSD: platform_ilp32_long.c,v 1.9 2024/03/30 16:47:45 rillig Exp $ */
|
||||||
# 3 "platform_ilp32_long.c"
|
# 3 "platform_ilp32_long.c"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,69 +46,69 @@ void
|
||||||
array_index(void)
|
array_index(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */
|
/* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x00ffffff];
|
u8 += u8_buf[0x00ffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */
|
/* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x7fffffff];
|
u8 += u8_buf[0x7fffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */
|
/* expect+1: warning: array subscript -2147483648 cannot be negative [167] */
|
||||||
u8 += u8_buf[2147483648];
|
u8 += u8_buf[2147483648];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */
|
/* expect+1: warning: array subscript -2147483648 cannot be negative [167] */
|
||||||
u8 += u8_buf[0x80000000];
|
u8 += u8_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffff];
|
u8 += u8_buf[0xffffffff];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */
|
/* expect+1: warning: array subscript -2147483648 cannot be negative [167] */
|
||||||
u8 += u8_buf[0x80000000];
|
u8 += u8_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffff];
|
u8 += u8_buf[0xffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0x00ffffffffffffff];
|
u8 += u8_buf[0x00ffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffffffffffff];
|
u8 += u8_buf[0xffffffffffffffff];
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */
|
/* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x00ffffff];
|
u64 += u64_buf[0x00ffffff];
|
||||||
/* expect+2: warning: '2147483647 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '2147483647 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 268435455 [168] */
|
/* expect+1: warning: array subscript 268435455 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x7fffffff];
|
u64 += u64_buf[0x7fffffff];
|
||||||
/* expect+3: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+3: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -268435456 [167] */
|
/* expect+1: warning: array subscript -268435456 cannot be negative [167] */
|
||||||
u64 += u64_buf[2147483648];
|
u64 += u64_buf[2147483648];
|
||||||
/* expect+3: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+3: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -268435456 [167] */
|
/* expect+1: warning: array subscript -268435456 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x80000000];
|
u64 += u64_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffff];
|
u64 += u64_buf[0xffffffff];
|
||||||
/* expect+3: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+3: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -268435456 [167] */
|
/* expect+1: warning: array subscript -268435456 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x80000000];
|
u64 += u64_buf[0x80000000];
|
||||||
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffff];
|
u64 += u64_buf[0xffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x00ffffffffffffff];
|
u64 += u64_buf[0x00ffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x0fffffffffffffff];
|
u64 += u64_buf[0x0fffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x1fffffffffffffff];
|
u64 += u64_buf[0x1fffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x3fffffffffffffff];
|
u64 += u64_buf[0x3fffffffffffffff];
|
||||||
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
/* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0x7fffffffffffffff];
|
u64 += u64_buf[0x7fffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffffffffffff];
|
u64 += u64_buf[0xffffffffffffffff];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: platform_lp64.c,v 1.12 2024/03/10 19:45:14 rillig Exp $ */
|
/* $NetBSD: platform_lp64.c,v 1.13 2024/03/30 16:47:45 rillig Exp $ */
|
||||||
# 3 "platform_lp64.c"
|
# 3 "platform_lp64.c"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,52 +54,52 @@ void
|
||||||
array_index(void)
|
array_index(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */
|
/* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x00ffffff];
|
u8 += u8_buf[0x00ffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */
|
/* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x7fffffff];
|
u8 += u8_buf[0x7fffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */
|
/* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[2147483648];
|
u8 += u8_buf[2147483648];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */
|
/* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x80000000];
|
u8 += u8_buf[0x80000000];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */
|
/* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0xffffffff];
|
u8 += u8_buf[0xffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */
|
/* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x80000000];
|
u8 += u8_buf[0x80000000];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */
|
/* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0xffffffff];
|
u8 += u8_buf[0xffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 72057594037927935 [168] */
|
/* expect+1: warning: array subscript 72057594037927935 cannot be > 19 [168] */
|
||||||
u8 += u8_buf[0x00ffffffffffffff];
|
u8 += u8_buf[0x00ffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u8 += u8_buf[0xffffffffffffffff];
|
u8 += u8_buf[0xffffffffffffffff];
|
||||||
|
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */
|
/* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x00ffffff];
|
u64 += u64_buf[0x00ffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */
|
/* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x7fffffff];
|
u64 += u64_buf[0x7fffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */
|
/* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[2147483648];
|
u64 += u64_buf[2147483648];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */
|
/* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x80000000];
|
u64 += u64_buf[0x80000000];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */
|
/* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0xffffffff];
|
u64 += u64_buf[0xffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */
|
/* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x80000000];
|
u64 += u64_buf[0x80000000];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */
|
/* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0xffffffff];
|
u64 += u64_buf[0xffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 72057594037927935 [168] */
|
/* expect+1: warning: array subscript 72057594037927935 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x00ffffffffffffff];
|
u64 += u64_buf[0x00ffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */
|
/* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x0fffffffffffffff];
|
u64 += u64_buf[0x0fffffffffffffff];
|
||||||
/* expect+2: warning: '2305843009213693951 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '2305843009213693951 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */
|
/* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x1fffffffffffffff];
|
u64 += u64_buf[0x1fffffffffffffff];
|
||||||
/* expect+2: warning: '4611686018427387903 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '4611686018427387903 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */
|
/* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x3fffffffffffffff];
|
u64 += u64_buf[0x3fffffffffffffff];
|
||||||
/* expect+2: warning: '9223372036854775807 * 8' overflows 'long' [141] */
|
/* expect+2: warning: '9223372036854775807 * 8' overflows 'long' [141] */
|
||||||
/* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */
|
/* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */
|
||||||
u64 += u64_buf[0x7fffffffffffffff];
|
u64 += u64_buf[0x7fffffffffffffff];
|
||||||
/* expect+1: warning: array subscript cannot be negative: -1 [167] */
|
/* expect+1: warning: array subscript -1 cannot be negative [167] */
|
||||||
u64 += u64_buf[0xffffffffffffffff];
|
u64 += u64_buf[0xffffffffffffffff];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: err.c,v 1.236 2024/03/29 07:35:45 rillig Exp $ */
|
/* $NetBSD: err.c,v 1.237 2024/03/30 16:47:44 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID)
|
#if defined(__RCSID)
|
||||||
__RCSID("$NetBSD: err.c,v 1.236 2024/03/29 07:35:45 rillig Exp $");
|
__RCSID("$NetBSD: err.c,v 1.237 2024/03/30 16:47:44 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -222,8 +222,8 @@ static const char *const msgs[] = {
|
||||||
"assignment of negative constant to unsigned type", // 164
|
"assignment of negative constant to unsigned type", // 164
|
||||||
"constant truncated by assignment", // 165
|
"constant truncated by assignment", // 165
|
||||||
"precision lost in bit-field assignment", // 166
|
"precision lost in bit-field assignment", // 166
|
||||||
"array subscript cannot be negative: %jd", // 167
|
"array subscript %jd cannot be negative", // 167
|
||||||
"array subscript cannot be > %d: %jd", // 168
|
"array subscript %jd cannot be > %d", // 168
|
||||||
"precedence confusion possible: parenthesize!", // 169
|
"precedence confusion possible: parenthesize!", // 169
|
||||||
"first operand of '?' must have scalar type", // 170
|
"first operand of '?' must have scalar type", // 170
|
||||||
"cannot assign to '%s' from '%s'", // 171
|
"cannot assign to '%s' from '%s'", // 171
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: init.c,v 1.266 2024/03/29 08:35:32 rillig Exp $ */
|
/* $NetBSD: init.c,v 1.267 2024/03/30 16:47:44 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID)
|
#if defined(__RCSID)
|
||||||
__RCSID("$NetBSD: init.c,v 1.266 2024/03/29 08:35:32 rillig Exp $");
|
__RCSID("$NetBSD: init.c,v 1.267 2024/03/30 16:47:44 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -801,8 +801,8 @@ initialization_add_designator_subscript(initialization *in, size_t subscript)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tp->t_incomplete_array && subscript >= (size_t)tp->u.dimension) {
|
if (!tp->t_incomplete_array && subscript >= (size_t)tp->u.dimension) {
|
||||||
/* array subscript cannot be > %d: %jd */
|
/* array subscript %jd cannot be > %d */
|
||||||
error(168, tp->u.dimension - 1, (intmax_t)subscript);
|
error(168, (intmax_t)subscript, tp->u.dimension - 1);
|
||||||
subscript = 0; /* suppress further errors */
|
subscript = 0; /* suppress further errors */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: tree.c,v 1.629 2024/03/29 08:35:32 rillig Exp $ */
|
/* $NetBSD: tree.c,v 1.630 2024/03/30 16:47:44 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID)
|
#if defined(__RCSID)
|
||||||
__RCSID("$NetBSD: tree.c,v 1.629 2024/03/29 08:35:32 rillig Exp $");
|
__RCSID("$NetBSD: tree.c,v 1.630 2024/03/30 16:47:44 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
@ -4435,11 +4435,11 @@ proceed:;
|
||||||
int dim = arr->tn_type->u.dimension + (taking_address ? 1 : 0);
|
int dim = arr->tn_type->u.dimension + (taking_address ? 1 : 0);
|
||||||
|
|
||||||
if (!is_uinteger(idx->tn_type->t_tspec) && con < 0)
|
if (!is_uinteger(idx->tn_type->t_tspec) && con < 0)
|
||||||
/* array subscript cannot be negative: %jd */
|
/* array subscript %jd cannot be negative */
|
||||||
warning(167, (intmax_t)con);
|
warning(167, (intmax_t)con);
|
||||||
else if (dim > 0 && (uint64_t)con >= (uint64_t)dim)
|
else if (dim > 0 && (uint64_t)con >= (uint64_t)dim)
|
||||||
/* array subscript cannot be > %d: %jd */
|
/* array subscript %jd cannot be > %d */
|
||||||
warning(168, dim - 1, (intmax_t)con);
|
warning(168, (uintmax_t)con, dim - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue