Actions
Bug #5280
closedC backend generates artificial structure declarators (field declarators) for unnamed structures and unions
Start date:
09/19/2014
Due date:
% Done:
0%
Estimated time:
Detected in build:
old
Platform:
Published in build:
Description
The linker successfully process this issues, but it causes problems for static analysis tools with linking several files as far as the input files contain different generated field names for the same struct type name.
For CPAchecker it looks like
Error: Parsing failed (Cannot access field ldv_7819 in struct lockref in file btmrvl_debugfs_o_i in line 13373: ( * dentry ) . d_lockref . ldv_7819 (full line is return ( unsigned int ) ( * dentry ) . d_lockref . ldv_7819 . ldv_7818 . count;)) (EclipseCParser.buildCFA, SEVERE)
Example
LDV Tools f50982e, CPAchecker r13530 no_cil linux-3.17-rc1.tar.xz 32_7a drivers/bluetooth/btmrvl.ko ldv_main1_sequence_infinite_withcheck_stateful
btmrvl_main.o.i:
struct lockref { # 33 "include/linux/lockref.h" union { # 32 "include/linux/lockref.h" struct { # 30 "include/linux/lockref.h" spinlock_t lock; unsigned int count; } ldv_16557; } ldv_16558; };
btmrvl_debugfs.o.i:
struct lockref { # 33 "include/linux/lockref.h" union { # 32 "include/linux/lockref.h" struct { # 30 "include/linux/lockref.h" spinlock_t lock; unsigned int count; } ldv_7818; } ldv_7819; };
Updated by Evgeny Novikov over 10 years ago
- Status changed from New to Open
- Assignee set to Evgeny Novikov
It can be a duplicate of #1138, but I am not sure.
Updated by Evgeny Novikov over 10 years ago
- Priority changed from Normal to High
Updated by Evgeny Novikov about 10 years ago
- Tracker changed from Feature to Bug
- Subject changed from C backend generates new names for unnamed structures and unions to C backend generates artificial structure declarators (field declarators) for unnamed structures and unions
- Detected in build set to old
It is worth mentioning that GCC supports empty structure declarator lists while C-backend doesn't support them and this was the source of the given issue:
struct-declaration: specifier-qualifier-list struct-declarator-list ; GNU extensions: struct-declaration: specifier-qualifier-list
Updated by Evgeny Novikov about 10 years ago
- Status changed from Open to Resolved
Fixed in 2c42610 (besides I had to fix accesses and initialization of these unnamed fields). Please, test it during a week and close the issue if everything will work!
Updated by Vadim Mutilin about 10 years ago
works on drivers/bluetooth/btmrvl.ko! thanks
Updated by Evgeny Novikov almost 3 years ago
- Related to Bug #11464: C back-end incorrectly handles initialization of anonymous unions added
Actions