GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 38077 - strict aliasing is not controllable via the option pragma or is not documented that way
Summary: strict aliasing is not controllable via the option pragma or is not documente...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.4.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2008-11-11 01:23 UTC by Andrew Pinski
Modified: 2013-11-10 15:59 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-11-11 20:34:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2008-11-11 01:23:52 UTC
When I was helping someone with a strict aliasing issue, I noticed that since the fix for PR 37106, the option pragma cannot control strict aliasing.  This is not documented at all but I think it would be a good idea to be able to control this option also.
Comment 1 Richard Biener 2008-11-11 20:34:48 UTC
Confirmed.
Comment 2 Bernd Edlinger 2013-11-10 15:59:26 UTC
As of current 4.9 trunk, that may have changed a bit.
but it still does not do what one would expect:

struct s
{
   int x:8;
   int y:24;
};

#pragma GCC push
#pragma GCC optimize ("strict-volatile-bitfields")
int foo(volatile struct s *x)
{
  return x->x;
}
#pragma GCC pop

#pragma GCC push
#pragma GCC optimize ("no-strict-volatile-bitfields")
int bar(volatile struct s *x)
{
  return x->x;
}
#pragma GCC pop


Both foo and bar are compiled as if -fno-strict-volatile-bitfields
was used on gcc-invocation. Whatever pragma is used last, wins...
push/pop are ignored, and does not restore the original settings.