include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer will break strict-aliasing rules

From: kbuild test robot
Date: Sat Mar 12 2016 - 23:29:15 EST


Hi Guenter,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fda604a4daa19ead458ce5471892fa1d4b382d82
commit: 398c7500a1f5f74e207bd2edca1b1721b3cc1f1e MIPS: VDSO: Fix build error with binutils 2.24 and earlier
date: 2 months ago
config: mips-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 398c7500a1f5f74e207bd2edca1b1721b3cc1f1e
# save the attached .config to linux build tree
make.cross ARCH=mips

All errors (new ones prefixed by >>):

In file included from include/linux/srcu.h:34:0,
from include/linux/notifier.h:15,
from arch/mips/include/asm/uprobes.h:9,
from include/linux/uprobes.h:61,
from include/linux/mm_types.h:13,
from arch/mips/include/asm/vdso.h:14,
from arch/mips/vdso/vdso.h:27,
from arch/mips/vdso/gettimeofday.c:11:
include/linux/workqueue.h: In function 'work_static':
>> include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
return *work_data_bits(work) & WORK_STRUCT_STATIC;
^
cc1: all warnings being treated as errors

vim +186 include/linux/workqueue.h

dd6414b5 Phil Carmody 2010-10-20 170
65f27f38 David Howells 2006-11-22 171 #define DECLARE_WORK(n, f) \
65f27f38 David Howells 2006-11-22 172 struct work_struct n = __WORK_INITIALIZER(n, f)
65f27f38 David Howells 2006-11-22 173
65f27f38 David Howells 2006-11-22 174 #define DECLARE_DELAYED_WORK(n, f) \
f991b318 Tejun Heo 2012-08-21 175 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
65f27f38 David Howells 2006-11-22 176
203b42f7 Tejun Heo 2012-08-21 177 #define DECLARE_DEFERRABLE_WORK(n, f) \
f991b318 Tejun Heo 2012-08-21 178 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
dd6414b5 Phil Carmody 2010-10-20 179
dc186ad7 Thomas Gleixner 2009-11-16 180 #ifdef CONFIG_DEBUG_OBJECTS_WORK
dc186ad7 Thomas Gleixner 2009-11-16 181 extern void __init_work(struct work_struct *work, int onstack);
dc186ad7 Thomas Gleixner 2009-11-16 182 extern void destroy_work_on_stack(struct work_struct *work);
ea2e64f2 Thomas Gleixner 2014-03-23 183 extern void destroy_delayed_work_on_stack(struct delayed_work *work);
4690c4ab Tejun Heo 2010-06-29 184 static inline unsigned int work_static(struct work_struct *work)
4690c4ab Tejun Heo 2010-06-29 185 {
22df02bb Tejun Heo 2010-06-29 @186 return *work_data_bits(work) & WORK_STRUCT_STATIC;
4690c4ab Tejun Heo 2010-06-29 187 }
dc186ad7 Thomas Gleixner 2009-11-16 188 #else
dc186ad7 Thomas Gleixner 2009-11-16 189 static inline void __init_work(struct work_struct *work, int onstack) { }
dc186ad7 Thomas Gleixner 2009-11-16 190 static inline void destroy_work_on_stack(struct work_struct *work) { }
ea2e64f2 Thomas Gleixner 2014-03-23 191 static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { }
4690c4ab Tejun Heo 2010-06-29 192 static inline unsigned int work_static(struct work_struct *work) { return 0; }
dc186ad7 Thomas Gleixner 2009-11-16 193 #endif
dc186ad7 Thomas Gleixner 2009-11-16 194

:::::: The code at line 186 was first introduced by commit
:::::: 22df02bb3fab24af97bff4c69cc6fd8529fc66fe workqueue: define masks for work flags and conditionalize STATIC flags

:::::: TO: Tejun Heo <tj@xxxxxxxxxx>
:::::: CC: Tejun Heo <tj@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data