public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix incomplete initialization of declspecs
       [not found] <56BB9471.8070901@t-online.de>
@ 2016-02-10 20:01 ` Bernd Schmidt
  2016-02-10 21:00   ` Joseph Myers
  0 siblings, 1 reply; 2+ messages in thread
From: Bernd Schmidt @ 2016-02-10 20:01 UTC (permalink / raw)
  To: GCC Patches; +Cc: Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

I've noticed that build_null_declspecs fails to clear out all location 
information since it's missing a multiplication with the type size. The 
simplest fix seems to be to just clear the entire structure.

Bootstrapping & testing now on x86_64-linux, ok if that succeeds? 
Depending on what we do for 69733, this might be a prerequisite patch.


Bernd

[-- Attachment #2: c-zero.diff --]
[-- Type: text/x-patch, Size: 1388 bytes --]

	* c-decl.c (build_null_declspecs): Zero the entire struct.

Index: gcc/c/c-decl.c
===================================================================
--- gcc/c/c-decl.c	(revision 233217)
+++ gcc/c/c-decl.c	(working copy)
@@ -9460,38 +9486,12 @@ struct c_declspecs *
 build_null_declspecs (void)
 {
   struct c_declspecs *ret = XOBNEW (&parser_obstack, struct c_declspecs);
-  memset (&ret->locations, 0, cdw_number_of_elements);
-  ret->type = 0;
-  ret->expr = 0;
-  ret->decl_attr = 0;
-  ret->attrs = 0;
+  memset (ret, 0, sizeof *ret);
   ret->align_log = -1;
   ret->typespec_word = cts_none;
   ret->storage_class = csc_none;
   ret->expr_const_operands = true;
-  ret->declspecs_seen_p = false;
   ret->typespec_kind = ctsk_none;
-  ret->non_sc_seen_p = false;
-  ret->typedef_p = false;
-  ret->explicit_signed_p = false;
-  ret->deprecated_p = false;
-  ret->default_int_p = false;
-  ret->long_p = false;
-  ret->long_long_p = false;
-  ret->short_p = false;
-  ret->signed_p = false;
-  ret->unsigned_p = false;
-  ret->complex_p = false;
-  ret->inline_p = false;
-  ret->noreturn_p = false;
-  ret->thread_p = false;
-  ret->thread_gnu_p = false;
-  ret->const_p = false;
-  ret->volatile_p = false;
-  ret->atomic_p = false;
-  ret->restrict_p = false;
-  ret->saturating_p = false;
-  ret->alignas_p = false;
   ret->address_space = ADDR_SPACE_GENERIC;
   return ret;
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix incomplete initialization of declspecs
  2016-02-10 20:01 ` Fix incomplete initialization of declspecs Bernd Schmidt
@ 2016-02-10 21:00   ` Joseph Myers
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Myers @ 2016-02-10 21:00 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: GCC Patches

On Wed, 10 Feb 2016, Bernd Schmidt wrote:

> I've noticed that build_null_declspecs fails to clear out all location
> information since it's missing a multiplication with the type size. The
> simplest fix seems to be to just clear the entire structure.
> 
> Bootstrapping & testing now on x86_64-linux, ok if that succeeds? Depending on
> what we do for 69733, this might be a prerequisite patch.

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-10 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <56BB9471.8070901@t-online.de>
2016-02-10 20:01 ` Fix incomplete initialization of declspecs Bernd Schmidt
2016-02-10 21:00   ` Joseph Myers

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).