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

            Bug ID: 63567
           Summary: Linux kernel build error due to non-static
                    initializers
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sasha.levin at oracle dot com

Hi all,

I'm seeing a new build issue with the linux kernel:

  CC      kernel/smpboot.o
In file included from include/linux/mutex.h:15:0,
                 from include/linux/kernfs.h:13,
                 from include/linux/sysfs.h:15,
                 from include/linux/kobject.h:21,
                 from include/linux/device.h:17,
                 from include/linux/node.h:17,
                 from include/linux/cpu.h:16,
                 from kernel/smpboot.c:4:
include/linux/spinlock_types.h:82:2: error: initializer element is not constant
  (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
  ^
include/linux/mutex.h:112:18: note: in expansion of macro
‘__SPIN_LOCK_UNLOCKED’
   , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \
                  ^
include/linux/mutex.h:118:27: note: in expansion of macro ‘__MUTEX_INITIALIZER’
  struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
                           ^
kernel/smpboot.c:80:8: note: in expansion of macro ‘DEFINE_MUTEX’
 static DEFINE_MUTEX(smpboot_threads_lock);
        ^
include/linux/spinlock_types.h:82:2: note: (near initialization for
‘smpboot_threads_lock.wait_lock’)
  (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
  ^
include/linux/mutex.h:112:18: note: in expansion of macro
‘__SPIN_LOCK_UNLOCKED’
   , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \
                  ^
include/linux/mutex.h:118:27: note: in expansion of macro ‘__MUTEX_INITIALIZER’
  struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
                           ^
kernel/smpboot.c:80:8: note: in expansion of macro ‘DEFINE_MUTEX’
 static DEFINE_MUTEX(smpboot_threads_lock);
        ^
make[1]: *** [kernel/smpboot.o] Error 1
make: *** [kernel/smpboot.o] Error 2


This was bisected down to:

commit b2601928b5bf34a817b5a9a2a371c476018e634d
Author: mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Oct 15 10:08:00 2014 +0000

        * doc/invoke.texi: Update to reflect that GNU11 is the default
        mode for C.
        * c-common.h (c_language_kind): Update comment.
    c-family/
        * c-opts.c (c_common_init_options): Make -std=gnu11 the default for C.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216247
138bc75d-0d04-0410-961f-82ee72b054a4

Reply via email to