[Bug 774] iptables-restore can't parses the quoted parameter correctly.
bugzilla-daemon at bugzilla.netfilter.org
bugzilla-daemon at bugzilla.netfilter.org
Mon Jul 23 18:10:38 CEST 2012
http://bugzilla.netfilter.org/show_bug.cgi?id=774
--- Comment #11 from Peter Wu <lekensteyn at gmail.com> 2012-07-23 18:10:38 CEST ---
The core of this bug is essentially the same as the below code snippet:
--- BEGIN CODE ---
#include <stdio.h>
int main() {
int i, j = 0;
for (i = 0; i < 5; i++) {
char x[10];
if (i == 4) {
x[i] = 0;
printf("%s\n", x);
break;
}
x[j++] = '0' + i;
}
return 0;
}
--- END CODE ---
You may expect "0123\n" to be printed, but if variable x is gone after the for
compound statement in the for-loop terminates, it is not guaranteed that x
equals the x identifier from the previous iteration. I though that this was the
"correct behaviour". But then I looked in the C standard document.
The ISO/IEC 9899:1999 document[1] states:
> An iteration statement is a block whose scope is a strict subset of
> the scope of its scope of enclosing block. The loop body is also a
> block whose scope is a strict subset of the scope of the iteration
> statement.
So "x" from the above code belongs to the scope of the whole for-loop
expression (for(A;B;C)D), and not just D if I have read the standard correctly?
In that case GCC does indeed have a bug and my previous assumption was wrong.
Does anyone already have pinged GCC?
[1]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
--
Configure bugmail: http://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.
You are watching someone on the CC list of the bug.
More information about the netfilter-buglog
mailing list