This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SRA and inconsistencies in bit-field types


> 
> 
> --=-=-=
> 
> I was asked to look into a GCC 4.1 bug and found it remains latent in
> mainline.  The problem is that the C++ front-end used to create
> bit-field fields with the declared type, but gimplification would
> access them in a narrower type/mode.
> 
> SRA didn't take this into account and scalarized such bit-fields into
> the wider type, not only wasting memory, but also introducing type
> inconsistencies as it substituted the fields accessed in the narrower
> types with the variables in the wider type, without any intervening
> conversion in the gimplified representation, which would ultimately
> cause the crash.
> 
> In the trunk, C++ uses the canonical type for the bit-fields already,
> so the problem does not arise, but canonicalization at gimplification
> time is still there, just waiting for an opportunity to bite.
> 
> I've added sanity checks while at that.
> 
> I've bootstrapped and regression-tested on x86_64-linux-gnu the
> following patches for trunk and 4.1 branch, respectively.  Ok to
> install?

This has caused a regression with complex types.
Simple testcase:

void foo()
{
  _Complex double z = ({ 0; 1.0i; });
}

>From PR 30846.

-- Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]