Project

General

Profile

Actions

Bug #5314

open

Invalid type encountered (hidden by variable name)

Added by Vadim Mutilin over 9 years ago. Updated about 8 years ago.

Status:
Open
Priority:
High
Category:
C back-end
Start date:
10/07/2014
Due date:
% Done:

0%

Estimated time:
Detected in build:
2c42610
Platform:
Published in build:

Description

For the code

         ax25_dev *ax25_dev;
         ...
         if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
                 goto free;

C-Backend generates

  ax25_dev *ax25_dev;
  # 232 "net/ax25/ax25_in.o.c.prepared" 
  ...
  # 234 "net/ax25/ax25_in.o.c.prepared" 
  if (( ax25_dev = ax25_dev_ax25dev ( dev ) ) == ( ( ax25_dev *) 0 ))
    goto free;

GCC error:

net/ax25/ax25_in.o.c.prepared: In function ‘ax25_rcv’:
net/ax25/ax25_in.o.c.prepared:234:64: error: expected expression before ‘)’ token

CPAchecker fails with

Error: Parsing failed (Invalid type encountered in: ax25_dev  in line 65224: ax25_dev (full line is if (( ax25_dev = ax25_dev_ax25dev ( dev ) ) == ( ( ax25_dev *) 0 ))
    goto free;)) (EclipseCParser.buildCFA, SEVERE)

32_7a, linux-3.17-rc1, net/ax25/ax25.ko

Actions #1

Updated by Evgeny Novikov over 9 years ago

  • Status changed from New to Feedback

Please, fix description since source code doesn't look good and it isn't clear where the bug.

Actions #2

Updated by Vadim Mutilin over 9 years ago

  • Description updated (diff)
Actions #3

Updated by Vadim Mutilin over 9 years ago

  • Status changed from Feedback to Open
Actions #4

Updated by Evgeny Novikov over 9 years ago

  • Assignee set to Evgeny Novikov

Looks like braces around "( ax25_dev *) 0" are excessive.

Actions #5

Updated by Alexey Khoroshilov over 9 years ago

Evgeny Novikov wrote:

Looks like braces around "( ax25_dev *) 0" are excessive.

Braces do not play any role. The problem is ax25_dev is redefined as variable name in local namespace instead of typedef name in global namespace. If NULL would be printed as ((void*)0), problem should gone.

Actions #6

Updated by Evgeny Novikov over 9 years ago

Thank you, I catch it now.

Actions #7

Updated by Evgeny Novikov about 8 years ago

  • Category set to C back-end
  • Priority changed from Normal to High
Actions

Also available in: Atom PDF