[Bug c/79927] New: 5.4.0: exponential notation triggers bogus "variably modified" warning
dtikhonov at litespeedtech dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 6 20:26:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79927
Bug ID: 79927
Summary: 5.4.0: exponential notation triggers bogus "variably
modified" warning
Product: gcc
Version: 5.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dtikhonov at litespeedtech dot com
Target Milestone: ---
I use a compile-time check to make sure that a particular value is correct:
------ 8< ----------
struct my_struct {
unsigned char n_usecs[3];
};
#ifndef ONE_MILLION
# define ONE_MILLION 1e6
#endif
/* Compile-time check that n_usecs holds at least 16 seconds worth. */
typedef char holds_at_least_16_seconds[
((1 << (sizeof(((struct my_struct *) 0)->n_usecs) * 8)) / ONE_MILLION
>= 16) - 1];
int
main (void)
{
return 0;
}
------ 8< ----------
Using 1e6 instead of 1000000 produces the following warning:
1e6.c:15:65: warning: variably modified ‘holds_at_least_16_seconds’ at file
scope
>= 16) - 1];
^
I reproduced this using 5.4.0 and 4.9.4 versions of gcc.
More information about the Gcc-bugs
mailing list