Project

General

Profile

Actions

Bug #911

closed

Cil doesn't eat the correct construction

Added by Evgeny Novikov about 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Category:
-
Target version:
Start date:
03/04/2011
Due date:
% Done:

0%

Estimated time:
Detected in build:
dd6d228 (unreleased)
Platform:
Published in build:

Description

I reduced the example up to the following (comments show where cil fails):

union ktime
{
};
typedef union ktime ktime_t;
struct hrtimer
{
  ktime_t _expires;
};
static inline ktime_t hrtimer_get_expires(struct hrtimer const *timer)
{
  /* Error: Cannot find matching union field in cast
     Error: cabs2cil/castTo: illegal cast  int  -> union ktime */
  return ( ktime_t ) ( * timer ) . _expires;
}

Gcc parses such the code even with -Wall option and it seems to be the correct one. So I believe that it's some bug in cil.
Even though this doesn't affect on next blast checking (it does it!) sometimes it may corrupt the whole process. Note that the only difference in comparing with the original source code is absence of explicit conversion ('->' is absolutely the same as '(*).'):
static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
{
 return timer->_expires;
}

Since ldv gcc pretty printer never skip explicit conversions as well as implicit ones this also must be related with cil.

Actions #1

Updated by Pavel Shved about 13 years ago

  • Status changed from New to Open
  • Priority changed from Normal to Urgent
  • Detected in build changed from svn to dd6d228 (unreleased)

Okay, since this parse error affects a number of drivers, we shoiuld fix it.

Actions #2

Updated by Pavel Shved about 13 years ago

CIL is capable to handle the GNU extension that allowed to make unions out of usual variables.

However, it completely omitted union -> union cast in this case.

The fix (yet unpublished) fixes the use case presented; I'll integrate it into BLAST, and run tests to check if it works in a couple of days.

Actions #3

Updated by Pavel Shved about 13 years ago

  • Status changed from Open to Resolved

The fix is committed to BLAST's master repository, and into the new-ri-integrated-libs branch.

Actions #4

Updated by Pavel Shved almost 13 years ago

  • Status changed from Resolved to Closed

Didn't see anything of it happen during recent aspectator's runs.

Actions #5

Updated by Pavel Shved over 12 years ago

  • Project changed from Linux Driver Verification to BLAST
  • Category deleted (BLAST)
Actions #6

Updated by Pavel Shved over 12 years ago

  • Target version set to 2.6
Actions

Also available in: Atom PDF