Project

General

Profile

Actions

Bug #1258

closed

C back-end processes typedefs on arrays incorrectly

Added by Evgeny Novikov over 13 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Urgent
Category:
C back-end
Start date:
05/20/2011
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:

Description

While implementing #1159 issue I noticed (also I have noticed it a long ago) that such typedefs:

#line 40 "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include/stdarg.h" 
typedef __builtin_va_list __gnuc_va_list;
#line 102 "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include/stdarg.h" 
typedef __gnuc_va_list va_list;

are printed as:
#line 40 "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include/stdarg.h" 
typedef __builtin_va_list __gnuc_va_list[1U];
#line 102 "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include/stdarg.h" 
typedef __gnuc_va_list va_list[1U];

In using __builtin_va_arg function:
...
va_list args;
...
__builtin_va_arg ( args , int );
...

this causes problems:
error: first argument to ‘va_arg’ not of type ‘va_list’

I believe that this problem touches not so many drivers.

Indeed the same issue is with all typedefs on arrays, e.g.:

typedef int T[10];
typedef T S;

becomes:
typedef int T[10];
typedef T S[10];

And the first look points to that we need to completely re-implement typedef processing in C back-end (Aspectator processes typedefs even worse).


Related issues 3 (0 open3 closed)

Related to C Instrumentation Framework - Bug #1159: Aspectator fails with incorrect expression codeClosedEvgeny Novikov05/03/2011

Actions
Related to C Instrumentation Framework - Bug #1165: GCC-aspectator fails with fatal error: incorrect reference codeClosedEvgeny Novikov05/03/2011

Actions
Has duplicate C Instrumentation Framework - Bug #7111: CIF causes a EMG failure due to incorrect result of inforequest provided for sound/oss/ad1848.koRejectedEvgeny Novikov04/26/2016

Actions
Actions #1

Updated by Evgeny Novikov over 13 years ago

Moreover it seems that CIL doesn't treat this as a error. So it isn't so important.

Actions #2

Updated by Evgeny Novikov over 13 years ago

  • Subject changed from C-backend processes variable arguments builtin typedefs incorrectly to C-backend processes variable arguments builtin typedefs and functions incorrectly

As was noticed in #1156 issue variable arguments functions are also printed incorrectly.
So someday we should discover what is variable argument processing at all and fix all problems. Small note: with Alexey we have found quickly that if we will eliminate all nonoriginal pointers, arrays and castings than we will obtain compilable sources :) But it isn't easy to do this may be. At the moment we can be glad that sources are checkable.

Actions #3

Updated by Evgeny Novikov over 13 years ago

Eugene Novikov wrote:

As was noticed in #1156 issue variable arguments functions are also printed incorrectly.

#1165 :)

Actions #4

Updated by Evgeny Novikov about 12 years ago

  • Project changed from Linux Driver Verification to C Instrumentation Framework
  • Category deleted (15)
Actions #5

Updated by Evgeny Novikov over 10 years ago

  • Priority changed from Normal to High

Vadim mentioned that the issue is unpleasant.

Actions #6

Updated by Vadim Mutilin over 10 years ago

Yes, it appears quite often when I prepare benchmarks for the competition.

Actions #7

Updated by Evgeny Novikov about 10 years ago

  • Subject changed from C-backend processes variable arguments builtin typedefs and functions incorrectly to C-backend processes typedefs on arrays incorrectly
  • Description updated (diff)
Actions #8

Updated by Vadim Mutilin over 9 years ago

The same problem appeares for SVGA3dCapPair from drivers/gpu/drm/vmwgfx/vmwgfx_kms.h (e.g. function vmw_fill_compat_cap http://lxr.free-electrons.com/source/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c?v=3.16#L141)

typedef uint32 SVGA3dCapPair[2U];

struct svga_3d_compat_cap
{
  SVGA3dCapsRecordHeader
  header;
  SVGA3dCapPair pairs[94U][2U];
};

should be

  SVGA3dCapPair pairs[94U];

Actions #9

Updated by Evgeny Novikov almost 9 years ago

  • Subject changed from C-backend processes typedefs on arrays incorrectly to C back-end processes typedefs on arrays incorrectly
  • Description updated (diff)
  • Category set to C back-end
Actions #10

Updated by Evgeny Novikov almost 9 years ago

#5323 likely duplicates this issue.

Actions #11

Updated by Evgeny Novikov over 5 years ago

  • Has duplicate Bug #7111: CIF causes a EMG failure due to incorrect result of inforequest provided for sound/oss/ad1848.ko added
Actions #12

Updated by Evgeny Novikov almost 4 years ago

  • Priority changed from High to Urgent

Though this issue is not crucial for Linux drivers since it is seldom, it is crucial, say, for LiteOS, where it breaks processing of the BSD part.

Actions #13

Updated by Evgeny Novikov almost 4 years ago

  • Status changed from Open to Closed

I hope that I finally fix this issue in b9a4c06. Some parts of this issue were fixed before. Now C back-end supports structure fields that are arrays of typedefs.

Actions

Also available in: Atom PDF