[Bug target/60336] empty struct value is passed differently in C and C++

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 27 17:58:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336

--- Comment #18 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #17)
> classify_argument has an early exit:
> 
>       /* Zero sized arrays or structures are NO_CLASS.  We return 0 to
> 	 signalize memory class, so handle it as special case.  */
> 
>       if (!words)
> 	{
> 	  classes[0] = X86_64_NO_CLASS;
> 	  return 1;
> 	}
> 
> but it doesn't trigger for c++, where words gets calculated as 1.

Yes, it looks like this special case is in order to return the same thing that
C++ does through the normal logic: normally we return 'words', and since there
are no fields classes[0] is still initialized to NO_CLASS.


More information about the Gcc-bugs mailing list