Bug #9534
closedIncorrect printing of Linux BUILD_BUG_ON
0%
Description
At the moment C back-end prints:
void __kfree_rcu(struct rcu_head *head, unsigned long offset)
{
...
((void)sizeof(char[1 - 2*!!(!__builtin_constant_p(offset))]));
...
}
as:
void __kfree_rcu(struct rcu_head *head, long unsigned int offset)
{
...
__builtin_constant_p ( offset ) == 0 ? -1 : 1, ( void ) ( long unsigned int ) ( __builtin_constant_p ( offset ) == 0 ? -1 : 1 );
...
}
This is definitely wrong.
Updated by Evgeny Novikov almost 6 years ago
- Blocks Bug #6629: Used CIL is outdated added
Updated by Evgeny Novikov almost 6 years ago
- Blocks Feature #9536: Update CIF added
Updated by Evgeny Novikov almost 6 years ago
- Blocks deleted (Bug #6629: Used CIL is outdated)
Updated by Evgeny Novikov almost 6 years ago
- Related to Bug #9546: Frama-C (CIL) for GCC does not behave like GCC when casting ternary operators added
Updated by Evgeny Novikov almost 6 years ago
- Related to Bug #5407: Duplicated labels are generated added
Updated by Evgeny Novikov almost 6 years ago
Indeed, the situation is not so bad, since there are no bugs in produced code. There is a bug in Frama-C (CIL) that can't parse it (#9536).
GCC calculates sizeofs internally, so, there are always some values and there are no sizeof expressions like in C. In this particular case the compiler could detect that there are no build bugs, i.e. "__builtin_constant_p ( offset ) 0" is always false at a compile time ("__builtin_constant_p(offset)" is always true) and we always have "sizeof(char[1])" that is 1. But there is still original expression calculating array size (it can be removed from the internal representation at all, but this does not happen).
I just dislike the outputted code since it includes "__builtin_constant_p ( offset ) 0 ? -1 : 1" 2 times that is not necessary at all. Perhaps, this causes #9534.
Updated by Evgeny Novikov almost 6 years ago
- Status changed from New to Rejected
- Assignee deleted (
Evgeny Novikov)
After all this just duplicates #5407.
Updated by Evgeny Novikov almost 6 years ago
- Related to deleted (Bug #5407: Duplicated labels are generated)
Updated by Evgeny Novikov almost 6 years ago
- Is duplicate of Bug #5407: Duplicated labels are generated added
Updated by Evgeny Novikov almost 6 years ago
- Blocks deleted (Feature #9536: Update CIF)