Closed
Description
This program (reduced slightly from llvm-test-suite's SingleSource/Regression/C/gcc-c-torture/execute/loop-3c.c
) fails with -Oz but passes with -O0, -O2, -Os.
$ /local/mnt/workspace/install/clang+llvm-19.1.5-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/hexagon-unknown-linux-musl-clang -Oz -o loop3c -static ~/tmp/loop3c.c -Wno-deprecated-non-prototype -Wno-implicit-int -Wno-implicit-function-declaration
/usr2/bcain/tmp/loop3c.c:17:1: warning: non-void function does not return a value [-Wreturn-type]
17 | }
| ^
1 warning generated.
$ /local/mnt/workspace/install/clang+llvm-19.1.5-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/qemu-hexagon ./loop3c
Aborted (core dumped)
#include <limits.h>
void * a[255];
f (m)
{
int i;
int sh = 0x100;
i = m;
do
{
a[sh >>= 1] = ((unsigned)i << 3) + (char*)a;
i += 4;
}
while (i < INT_MAX/2 + 1 + 4 * 4);
}
main ()
{
a[0x10] = 0;
a[0x08] = 0;
f (INT_MAX/2 + INT_MAX/4 + 2);
if (a[0x10] || a[0x08])
abort ();
}
Metadata
Metadata
Assignees
Type
Projects
Status
Done