This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, i386]: Fix PR 60017 Struct not returned correctly


On Sun, Feb 2, 2014 at 5:35 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Sun, Feb 02, 2014 at 04:31:35PM +0100, Uros Bizjak wrote:
>> There is off-by-one error in classify_argument, when processing
>> integer atomic types. When bit_offset is 64, two X86_64_INTEGER CLASS
>> registers should be used.
>>
>> Attached patch fixes this off-by-one error, so we won't use size = 0
>> when bit_offset = 64.
>>
>> 2014-02-02  Uros Bizjak  <ubizjak@gmail.com>
>>
>>     PR target/60017
>>     * config/i386/i386.c (classify_argument): Fix handling of bit_offset
>>     when calculating size of integer atomic types.
>>
>> testsuite/ChangeLog:
>>
>> 2014-02-02  Uros Bizjak  <ubizjak@gmail.com>
>>
>>     PR target/60017
>>     * gcc.c-torture/execute/pr60017.c: New test.
>>
>> Tested on x86_64-linux-gnu, committed to mainline SVN.
>
> Isn't it something for -Wpsabi warning, or is purely a bug, where the
> affected structures just aren't passed correctly that way at all
> (arguments/return values?), meaning that the value passed by caller doesn't
> match the value seen by callee or vice versa?  Does it affect passing of
> following arguments?  If yes, that could still be worthwhile to warn about,
> say for programs that pass such structures and something after that as
> parameters, but don't actually look at the problematic structure argument
> or only look at the first few bytes from it, just care about the next
> argument.

It is purely a bug. We expect the value in a 32bit register, so in
effect, top 32bits are stripped from the 64bit return reg in the
calling function. As can be seen from the testcase, the value value is
still loaded in 64bit register in the called function.

Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]