https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70749

            Bug ID: 70749
           Summary: [4.9/5 Regression] error: storage size of ‘a’ isn’t
                    known goes away with -Os
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

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.

Reply via email to