diff mbox series

[aarch64] Issue warning/error for mixing functions with/without aarch64_vector_pcs attribute

Message ID dbc859a9915fd192d8027651418c1662800a3cc9.camel@marvell.com
State New
Headers show
Series [aarch64] Issue warning/error for mixing functions with/without aarch64_vector_pcs attribute | expand

Commit Message

Steve Ellcey Feb. 13, 2019, 11:34 p.m. UTC
Szabolcs pointed out that my SIMD ABI patches that implement the
aarch64_vector_pcs attribute do not generate a warning or error
when being mixed with functions that do not have the attribute because
the 'affects_type_identity' field was false in the attribute table.

This patch fixes that.  I thought I could just set it to true but it
turned out I also had to implement TARGET_COMP_TYPE_ATTRIBUTES as well.

This patch does that and adds a test case to check for the error
when assigning a function with the attribute to a pointer type without
the attribute.

The test checks for an error because the testsuite adds -pedantic-
errors to the compile line.  Without this you would just get a warning,
but that is consistent with any mixing of different function types in a
function pointer assignment.

Tested with a bootstrap build and test run on aarch64.  OK for checkin?

Steve Ellcey
sellcey@marvell.com


2018-02-13  Steve Ellcey  <sellcey@marvell.com>

	* config/aarch64/aarch64.c (aarch64_attribute_table): Change
	affects_type_identity to true for aarch64_vector_pcs.
	(aarch64_comp_type_attributes): New function.
	(TARGET_COMP_TYPE_ATTRIBUTES): New macro.

2018-02-13  Steve Ellcey  <sellcey@marvell.com>

	* gcc.target/aarch64/pcs_attribute.c: New test.

Comments

Richard Sandiford Feb. 14, 2019, 9:02 a.m. UTC | #1
Steve Ellcey <sellcey@marvell.com> writes:
> Szabolcs pointed out that my SIMD ABI patches that implement the
> aarch64_vector_pcs attribute do not generate a warning or error
> when being mixed with functions that do not have the attribute because
> the 'affects_type_identity' field was false in the attribute table.
>
> This patch fixes that.  I thought I could just set it to true but it
> turned out I also had to implement TARGET_COMP_TYPE_ATTRIBUTES as well.

Yeah, looks like the flag just controls whether the attribute should
be printed as part of the type, to give sensible error messages.

> This patch does that and adds a test case to check for the error
> when assigning a function with the attribute to a pointer type without
> the attribute.
>
> The test checks for an error because the testsuite adds -pedantic-
> errors to the compile line.  Without this you would just get a warning,
> but that is consistent with any mixing of different function types in a
> function pointer assignment.
>
> Tested with a bootstrap build and test run on aarch64.  OK for checkin?
>
> Steve Ellcey
> sellcey@marvell.com
>
>
> 2018-02-13  Steve Ellcey  <sellcey@marvell.com>
>
> 	* config/aarch64/aarch64.c (aarch64_attribute_table): Change
> 	affects_type_identity to true for aarch64_vector_pcs.
> 	(aarch64_comp_type_attributes): New function.
> 	(TARGET_COMP_TYPE_ATTRIBUTES): New macro.
>
> 2018-02-13  Steve Ellcey  <sellcey@marvell.com>
>
> 	* gcc.target/aarch64/pcs_attribute.c: New test.

OK, thanks.

Richard
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/aarch64/pcs_attribute.c b/gcc/testsuite/gcc.target/aarch64/pcs_attribute.c
index e69de29bb2d..9a99b91a6ed 100644
--- a/gcc/testsuite/gcc.target/aarch64/pcs_attribute.c
+++ b/gcc/testsuite/gcc.target/aarch64/pcs_attribute.c
@@ -0,0 +1,7 @@ 
+/* { dg-do compile } */
+ 
+/* Test that the assignment of f (with the attribute) to function pointer g
+   (with no attribute) results in an error.  */
+
+__attribute__((aarch64_vector_pcs)) void f(void);
+void (*g)(void) = f; /* { dg-error "incompatible pointer type" } */