[Bug c/86584] New: Incorrect -Wsequence-point warning on structure member
rusty at rustcorp dot com.au
gcc-bugzilla@gcc.gnu.org
Thu Jul 19 07:06:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86584
Bug ID: 86584
Summary: Incorrect -Wsequence-point warning on structure member
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: rusty at rustcorp dot com.au
Target Milestone: ---
gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, x86-64. Also in gcc-8 (Ubuntu
8.1.0-1ubuntu1) 8.1.0.
I have a macro which does an assignment, and also hands the address of the same
var to the function. The reduced version is below: it gives a spurious warning
when the var involved is a struct member:
struct s {
int f;
};
void func(int *f, int);
int main(void)
{
struct s s;
int f;
/* bad-warning-gcc.c:13:17: warning: operation on ‘s.f’ may be
undefined [-Wsequence-point] */
func(&s.f, s.f = 1);
/* No warning for this */
func(&f, f = 1);
return 0;
}
More information about the Gcc-bugs
mailing list