Project

General

Profile

Actions

Bug #5280

closed

C backend generates artificial structure declarators (field declarators) for unnamed structures and unions

Added by Vadim Mutilin almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
High
Category:
-
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;
};


Related issues 1 (0 open1 closed)

Related to C Instrumentation Framework - Bug #11464: C back-end incorrectly handles initialization of anonymous unionsClosedEvgeny Novikov03/05/2022

Actions
Actions

Also available in: Atom PDF