[Bug c/79674] New: Missed optimisation when no sequence point present
etienne_lorrain at yahoo dot fr
gcc-bugzilla@gcc.gnu.org
Wed Feb 22 11:54:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674
Bug ID: 79674
Summary: Missed optimisation when no sequence point present
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: etienne_lorrain at yahoo dot fr
Target Milestone: ---
It may be controvertial use, but I would like to report it with low priority...
Having this code (tested on GCC7):
------>o--o<---------
static inline void parallel (int c_compliant, ...) {}
volatile struct { unsigned char r, g, b, t; } vol_str;
void fct1 (void)
{
vol_str.r = 1,
vol_str.g = 2,
vol_str.b = 3,
vol_str.t = 0;
}
void fct2 (void)
{
parallel (vol_str.r = 1, vol_str.g = 2, vol_str.b = 3, vol_str.t = 0);
}
------>o--o<---------
fct1 has to be translated into four independant byte writes because since some
ANSI standard the comma (used like this) has become a sequence point.
but fct2 could be compiled into a single 32 bits write because there are no
sequence point when we use the comma to separate parameters in a function call
(hence the name of the function: parallel)...
More information about the Gcc-bugs
mailing list