diff mbox

[PR77558] Remove RECORD_TYPE special-casing in std_canonical_va_list_type

Message ID 2908590d-f799-7053-9f52-2f0b65803c4e@mentor.com
State New
Headers show

Commit Message

Tom de Vries Sept. 25, 2016, 9:08 a.m. UTC
Hi,

this patch fixes PR77558, an ice-on-invalid-code 6/7 regression.

The fix for PR71602 introduced the invalid-code test-case 
c-c++-common/va-arg-va-list-type.c:
...
__builtin_va_list *pap;

void
fn1 (void)
{
   __builtin_va_arg (pap, double); /* { dg-error "first argument to 
'va_arg' not of type 'va_list'" } */
}
...

The test-case passes for x86_64, but fails for aarch64 and ICEs for arm.

The ICE happens because the patch for PR71602 is incomplete. The patch 
tries to be more strict about returning a canonical va_list only for 
actual va_lists, but doesn't implement this for structure va_list types, 
such as we have for arm, aarch64 and alpha.

This patch adds the missing part, and fixes the ICE.

OK for trunk, 6-branch?

Thanks,
- Tom

Comments

Tamar Christina Oct. 7, 2016, 3:25 p.m. UTC | #1
Ping?

Would be great to get this in, it's currently showing up as a major issue on our nightlies.

Cheers,
Tamar

> -----Original Message-----

> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-

> owner@gcc.gnu.org] On Behalf Of Tom de Vries

> Sent: 25 September 2016 10:08

> To: GCC Patches

> Subject: [PATCH, PR77558] Remove RECORD_TYPE special-casing in

> std_canonical_va_list_type

> 

> Hi,

> 

> this patch fixes PR77558, an ice-on-invalid-code 6/7 regression.

> 

> The fix for PR71602 introduced the invalid-code test-case

> c-c++-common/va-arg-va-list-type.c:

> ...

> __builtin_va_list *pap;

> 

> void

> fn1 (void)

> {

>    __builtin_va_arg (pap, double); /* { dg-error "first argument to 'va_arg' not

> of type 'va_list'" } */ } ...

> 

> The test-case passes for x86_64, but fails for aarch64 and ICEs for arm.

> 

> The ICE happens because the patch for PR71602 is incomplete. The patch

> tries to be more strict about returning a canonical va_list only for actual

> va_lists, but doesn't implement this for structure va_list types, such as we

> have for arm, aarch64 and alpha.

> 

> This patch adds the missing part, and fixes the ICE.

> 

> OK for trunk, 6-branch?

> 

> Thanks,

> - Tom
Richard Biener Oct. 10, 2016, 9:53 a.m. UTC | #2
On Sun, Sep 25, 2016 at 11:08 AM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> Hi,
>
> this patch fixes PR77558, an ice-on-invalid-code 6/7 regression.
>
> The fix for PR71602 introduced the invalid-code test-case
> c-c++-common/va-arg-va-list-type.c:
> ...
> __builtin_va_list *pap;
>
> void
> fn1 (void)
> {
>   __builtin_va_arg (pap, double); /* { dg-error "first argument to 'va_arg'
> not of type 'va_list'" } */
> }
> ...
>
> The test-case passes for x86_64, but fails for aarch64 and ICEs for arm.
>
> The ICE happens because the patch for PR71602 is incomplete. The patch tries
> to be more strict about returning a canonical va_list only for actual
> va_lists, but doesn't implement this for structure va_list types, such as we
> have for arm, aarch64 and alpha.
>
> This patch adds the missing part, and fixes the ICE.
>
> OK for trunk, 6-branch?

Ok.

Richard.

> Thanks,
> - Tom
Christophe Lyon Oct. 11, 2016, 12:01 p.m. UTC | #3
On 10 October 2016 at 11:53, Richard Biener <richard.guenther@gmail.com> wrote:
> On Sun, Sep 25, 2016 at 11:08 AM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> Hi,
>>
>> this patch fixes PR77558, an ice-on-invalid-code 6/7 regression.
>>
>> The fix for PR71602 introduced the invalid-code test-case
>> c-c++-common/va-arg-va-list-type.c:
>> ...
>> __builtin_va_list *pap;
>>
>> void
>> fn1 (void)
>> {
>>   __builtin_va_arg (pap, double); /* { dg-error "first argument to 'va_arg'
>> not of type 'va_list'" } */
>> }
>> ...
>>
>> The test-case passes for x86_64, but fails for aarch64 and ICEs for arm.
>>
>> The ICE happens because the patch for PR71602 is incomplete. The patch tries
>> to be more strict about returning a canonical va_list only for actual
>> va_lists, but doesn't implement this for structure va_list types, such as we
>> have for arm, aarch64 and alpha.
>>
>> This patch adds the missing part, and fixes the ICE.
>>
>> OK for trunk, 6-branch?
>
> Ok.
>

Hi Tom,

It seems your patch broke the gcc-6 branch.
I'm seeing build failures (arm*/aarch64* targets):
/tmp/4929309_2.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-linux-gnueabi/gcc2/./gcc/xgcc
-B/tmp/4929309_2.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm
-none-linux-gnueabi/gcc2/./gcc/
-B/tmp/4929309_2.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/bin/
-B/tmp/4929309_2.tmpdir/aci-gcc-fsf/buil
ds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/lib/ -isystem
/tmp/4929309_2.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/include
-isystem /
tmp/4929309_2.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-linux-gnueabi/sys-include
   -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wal
l -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g
-DIN_LIBGCC2 -fbuilding-lib
gcc -fno-stack-protector   -fPIC -fno-inline -I. -I. -I../.././gcc
-I/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc
-I/tmp/4929309_2.tmpdir/aci-gcc
-fsf/sources/gcc-fsf/gccsrc/libgcc/.
-I/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/../gcc
-I/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gc
csrc/libgcc/../include  -DHAVE_CC_TLS  -o _gcov_execlp.o -MT
_gcov_execlp.o -MD -MP -MF _gcov_execlp.dep -DL_gcov_execlp -c
/tmp/4929309_2.tmpdir/aci-gcc-fsf/source
s/gcc-fsf/gccsrc/libgcc/libgcov-interface.c
In file included from
/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/../gcc/tsystem.h:84:0,
                 from
/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov.h:41,
                 from
/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov-interface.c:26:
/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov-interface.c:
In function '__gcov_execl':
/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov-interface.c:204:22:
error: first argument to 'va_arg' not of type 'va_list'
   while (va_arg (ap, char *))
                      ^
/tmp/4929309_2.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov-interface.c:211:27:
error: first argument to 'va_arg' not of type 'va_list'
     args[i] = va_arg (aq, char *);
                           ^
make[2]: *** [_gcov_execl.o] Error 1


Christophe

> Richard.
>
>> Thanks,
>> - Tom
diff mbox

Patch

Remove RECORD_TYPE special-casing in std_canonical_va_list_type

2016-09-25  Tom de Vries  <tom@codesourcery.com>

	PR middle-end/77558
	* builtins.c (std_canonical_va_list_type): Remove RECORD_TYPE
	special-casing.

---
 gcc/builtins.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9a19a75..f91e6d3 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4089,10 +4089,8 @@  std_canonical_va_list_type (tree type)
 
   wtype = va_list_type_node;
   htype = type;
-  /* Treat structure va_list types.  */
-  if (TREE_CODE (wtype) == RECORD_TYPE && POINTER_TYPE_P (htype))
-    htype = TREE_TYPE (htype);
-  else if (TREE_CODE (wtype) == ARRAY_TYPE)
+
+  if (TREE_CODE (wtype) == ARRAY_TYPE)
     {
       /* If va_list is an array type, the argument may have decayed
 	 to a pointer type, e.g. by being passed to another function.