I'm hitting an error when trying to build an allyesconfig arm64 linux kernel (4.5.2) (with an aarch64-none-linux-gnu toolchain). drivers/staging/wilc1000/wilc_spi.c:123:34: error: storage size of ‘wilc1000_spi_ops’ isn’t known static const struct wilc1000_ops wilc1000_spi_ops; ^~~~~~~~~~~~~~~~ I don't get this error when compiling with the GCC 5 branch. creduce reduces this to just: static struct wilc1000_ops a; The weird behaviour is on the GCC 5 branch in that I get the error: bug.i:1:28: error: storage size of ‘a’ isn’t known static struct wilc1000_ops a; ^ when compiling with -std=gnu89 bug.i -S but it is compiled without an error (into an empty file) if I add -Os: -std=gnu89 bug.i -S -Os This behaviour occurs on GCC 5 and 4.9 and 4.8. GCC 6 and trunk give the error regardless of optimization level.
What version works for you? Even 4.3 doesn't error at -O. I suspect older compiler eliminate a before diagnosing it.
Trunk errors with or without optimisation. GCC 5 and earlier don't error with optimisation. If this behaviour is expected (and the bug is in the kernel sources) feel free to close the report. I just thought it curious that the error depends on optimisation level.
*** Bug 70950 has been marked as a duplicate of this bug. ***
Dup of bug 24293. *** This bug has been marked as a duplicate of bug 24293 ***