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]

[Ada] fix spurious "misaligned actual" error with -gnatE


-gnatE might turn a valid actual for a tagged formal to be passed by
ref into a conditional expression, supriously rejected as a "misaligned"
actual because not addressable_p.

Both arms of the COND_EXPR are addressable here, we'd expect
&COND_EXPR to yield the address of the selected operand in this case,
and the default gimplifier's behavior is in line with this.

The first part of this change ensures COND_EXPR where both arms are
addressable is deemed addressable as well.  The second part ensures
we let the gimplifier perform its job on &COND_EXPR, which we were
preempting so far to bogusly take the address of a temporary copy of
the COND_EXPR value.

Our only testcase is unfortunately fairly large and proprietary.
While efforts to reduce it failed to produce something we could file
here, they exposed a compiler crash on an illegal variant, caused by
an oversight in the error reporting circuitry, fixed by the call_to_gnu
part of this change.

Bootstrapped and regtested on x86_64-suse-linux.

2008-03-21  Olivier Hainque  <hainque@adacore.com>
            Ed Schonberg  <schonberg@adacore.com>

        * trans.c (addressable_p): Accept COND_EXPR when both arms
        are addressable.
        (gnat_gimplify_expr): Let the gimplifier handle &COND_EXPR.
        (call_to_gnu): Do not use name reference in the error message
        for a misaligned by_reference_parameter. The actual may be a
        general expression.

Attachment: addr_cond_expr.dif
Description: Text document


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