https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348
MCCCS <mcccs at gmx dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mcccs at gmx dot com
--- Comment #2 from MCCCS <mcccs at gmx dot com> ---
/*Below's the compiler testsuite code with no headers.
Here's the assembly difference (because the difference is very small. The one
on the left works (-O1 only) while the one on the right has `-O1
-finline-small-functions`): https://www.diffchecker.com/hAYLeoPV
I've also tested it on macOS 10.14 with GCC 8, it failed too.
In addition, on Aarch64 - Raspberry/Raspbian using GCC 6 and GCC 9: GCC 9 also
failed on ARM, but GCC 6 didn't cause assertion fail, thus it's clearly a
7/8/9/10 regression.*/
/* { dg-do run } */
/* { dg-options "-O2" } */
void __attribute__ ((noinline)) set_one (unsigned char* ptr)
{
*ptr = 1;
}
int __attribute__ ((noinline)) check_nonzero (unsigned char const* in, unsigned
int len)
{
for (unsigned int i = 0; i < len; ++i) {
if (in[i] != 0) return 1;
}
return 0;
}
void set_one_on_stack () {
unsigned char buf[1];
set_one (buf);
}
int main () {
for (int i = 0; i < 5; ++i) {
unsigned char in[4];
for (int j = 0; j < i; ++j) {
in[j] = 0;
set_one_on_stack ();
}
if (check_nonzero (in, i)) {
__builtin_abort ();
}
}
}
//~ MCCCS (DesWurstes)