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: [PATCH, PR40351] When creating artificial (copy-propagation) sub-accesses, check that they make sense


2009/6/8 Martin Jambor <mjambor@suse.cz>:
> Hi,
>
> this ?patch fixes ?PR 40351, caused ?by ?the ?fact ?that we ?propagate
> sub-accesses across assignments, unions can now trick us into creating
> some which ?do not make ?sense (they do ?not exist in a ?union field).
> The ?patch ?below checks ?that ?does ?not ?happen before ?creating ?an
> artificial access.
>
> Bootstrapped and regression tested on x86_64-linux. ?OK for trunk?

Hm.  Ok with a comment before that call.

Richard.

> Thanks,
>
> Martin
>
> 2009-06-05 ?Martin Jambor ?<mjambor@suse.cz>
>
> ? ? ? ?PR tree-optimization/40351
> ? ? ? ?* tree-sra.c (propagate_subacesses_accross_link): Check that a refrence
> ? ? ? ?to a potential artifical subaccess can be constructed.
>
> ? ? ? ?* testsuite/gcc.c-torture/compile/pr40351.c: New file.
>
> Index: gcc/testsuite/gcc.c-torture/compile/pr40351.c
> ===================================================================
> --- gcc/testsuite/gcc.c-torture/compile/pr40351.c ? ? ? (revision 0)
> +++ gcc/testsuite/gcc.c-torture/compile/pr40351.c ? ? ? (revision 0)
> @@ -0,0 +1,22 @@
> +/* PR tree-optimizations/40351 */
> +
> +struct IO_APIC_route_entry {
> + ? ?unsigned int vector : 8;
> + ? ?unsigned int delivery_mode : 1;
> + ? ?unsigned int mask : 1;
> + ? ?unsigned int __reserved_2 : 15;
> + ? ?unsigned int __reserved_3 : 8;
> +} __attribute__ ((packed));
> +union entry_union {
> + ? ?struct {
> + ? ? ? ?unsigned int w1, w2;
> + ? ?};
> + ? ?struct IO_APIC_route_entry entry;
> +};
> +unsigned int io_apic_read(void);
> +struct IO_APIC_route_entry ioapic_read_entry(void)
> +{
> + ?union entry_union eu;
> + ?eu.w1 = io_apic_read();
> + ?return eu.entry;
> +}
> Index: gcc/tree-sra.c
> ===================================================================
> --- gcc/tree-sra.c ? ? ?(revision 148205)
> +++ gcc/tree-sra.c ? ? ?(working copy)
> @@ -1544,6 +1544,10 @@ propagate_subacesses_accross_link (struc
> ? ? ? ? ?continue;
> ? ? ? ?}
>
> + ? ? ?if (!build_ref_for_offset (NULL, TREE_TYPE (lacc->base), norm_offset,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rchild->type, false))
> + ? ? ? continue;
> +
> ? ? ? new_acc = create_artificial_child_access (lacc, rchild, norm_offset);
> ? ? ? if (racc->first_child)
> ? ? ? ?propagate_subacesses_accross_link (new_acc, rchild);
>
>


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