* [PATCH] Fix PR70931
@ 2016-05-06 7:35 Richard Biener
2016-05-06 7:37 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2016-05-06 7:35 UTC (permalink / raw)
To: gcc-patches; +Cc: Jakub Jelinek
The following makes us skip zero-sized fields when encoding
aggregate constructors to avoid ICEing when recursing with size == 0.
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok?
Thanks,
Richard.
2016-05-06 Richard Biener <rguenther@suse.de>
PR middle-end/70931
* dwarf2out.c (native_encode_initializer): Skip zero-sized fields.
* gfortran.dg/pr70931.f90: New testcase.
Index: gcc/dwarf2out.c
===================================================================
*** gcc/dwarf2out.c (revision 235859)
--- gcc/dwarf2out.c (working copy)
*************** native_encode_initializer (tree init, un
*** 17806,17812 ****
fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field));
pos = int_byte_position (field);
gcc_assert (pos + fieldsize <= size);
! if (val
&& !native_encode_initializer (val, array + pos, fieldsize))
return false;
}
--- 17806,17812 ----
fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field));
pos = int_byte_position (field);
gcc_assert (pos + fieldsize <= size);
! if (val && fieldsize != 0
&& !native_encode_initializer (val, array + pos, fieldsize))
return false;
}
Index: gcc/testsuite/gfortran.dg/pr70931.f90
===================================================================
*** gcc/testsuite/gfortran.dg/pr70931.f90 (revision 0)
--- gcc/testsuite/gfortran.dg/pr70931.f90 (working copy)
***************
*** 0 ****
--- 1,10 ----
+ ! { dg-do compile }
+ ! { dg-options "-g" }
+ program p
+ type t
+ integer :: a
+ integer :: b(0)
+ end type
+ type(t), parameter :: z = t(1, [2])
+ print *, z
+ end
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix PR70931
2016-05-06 7:35 [PATCH] Fix PR70931 Richard Biener
@ 2016-05-06 7:37 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2016-05-06 7:37 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
On Fri, May 06, 2016 at 09:35:18AM +0200, Richard Biener wrote:
>
> The following makes us skip zero-sized fields when encoding
> aggregate constructors to avoid ICEing when recursing with size == 0.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, ok?
Ok (looks safe even for the branch).
> 2016-05-06 Richard Biener <rguenther@suse.de>
>
> PR middle-end/70931
> * dwarf2out.c (native_encode_initializer): Skip zero-sized fields.
>
> * gfortran.dg/pr70931.f90: New testcase.
>
> Index: gcc/dwarf2out.c
> ===================================================================
> *** gcc/dwarf2out.c (revision 235859)
> --- gcc/dwarf2out.c (working copy)
> *************** native_encode_initializer (tree init, un
> *** 17806,17812 ****
> fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field));
> pos = int_byte_position (field);
> gcc_assert (pos + fieldsize <= size);
> ! if (val
> && !native_encode_initializer (val, array + pos, fieldsize))
> return false;
> }
> --- 17806,17812 ----
> fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field));
> pos = int_byte_position (field);
> gcc_assert (pos + fieldsize <= size);
> ! if (val && fieldsize != 0
> && !native_encode_initializer (val, array + pos, fieldsize))
> return false;
> }
> Index: gcc/testsuite/gfortran.dg/pr70931.f90
> ===================================================================
> *** gcc/testsuite/gfortran.dg/pr70931.f90 (revision 0)
> --- gcc/testsuite/gfortran.dg/pr70931.f90 (working copy)
> ***************
> *** 0 ****
> --- 1,10 ----
> + ! { dg-do compile }
> + ! { dg-options "-g" }
> + program p
> + type t
> + integer :: a
> + integer :: b(0)
> + end type
> + type(t), parameter :: z = t(1, [2])
> + print *, z
> + end
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-06 7:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-06 7:35 [PATCH] Fix PR70931 Richard Biener
2016-05-06 7:37 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).