public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
@ 2014-06-12 11:23 yufeng at gcc dot gnu.org
  2014-06-12 11:24 ` [Bug target/61483] " yufeng at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: yufeng at gcc dot gnu.org @ 2014-06-12 11:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483

            Bug ID: 61483
           Summary: [AArch64] builtin va_start incorrectly initializes the
                    field of va_list for incoming unnamed arguments on the
                    stack
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yufeng at gcc dot gnu.org

The following code is mis-compiled by gcc, when targeting aarch64. The issue is
that the second variadic argument to callee_b0f, which is of type long long, is
not retrieved correctly inside the callee.

------------------- CODE -------------------
#include <stdarg.h>
#include <stdio.h>

struct float_float_t { float a, b;  } float_float = {1.2, 2.2};

union float_int_t {
    float b8;
    int b5;
} float_int = {4983.80};

long long correct = 12683143434LL;

long long callee_b0f(float f1, float f2, float f3, float f4,
                float f5, float f6, float f7, struct float_float_t ff,
                int i1, int i2, int i3, int i4,
                int i5, int i6, int i7,
                ...) {
    va_list ap;
    va_start(ap, i7);

    va_arg(ap, union float_int_t);
    long long var = va_arg(ap, long long);

    va_end(ap);

    return var;
}

int main()
{
    long long check = callee_b0f(1.0, 2.0, 3.0, 4.0,
                                 5.0, 6.0, 7.0, float_float,
                                 9, 10, 11, 12,
                                 13, 14, 15,
                                 float_int, correct);
    printf("%lld\n%lld\n", correct, check);
    return 0;
}

------------------- CUT -------------------

Expected output:

12683143434
12683143434

Actual output:

12683143434
0

I have checked that this bug is present since 4.8.0 (day one of the aarch64
port).


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

* [Bug target/61483] [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
  2014-06-12 11:23 [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack yufeng at gcc dot gnu.org
@ 2014-06-12 11:24 ` yufeng at gcc dot gnu.org
  2014-06-12 11:25 ` yufeng at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: yufeng at gcc dot gnu.org @ 2014-06-12 11:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483

Yufeng Zhang <yufeng at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |aarch64
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-06-12
           Assignee|unassigned at gcc dot gnu.org      |yufeng at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [Bug target/61483] [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
  2014-06-12 11:23 [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack yufeng at gcc dot gnu.org
  2014-06-12 11:24 ` [Bug target/61483] " yufeng at gcc dot gnu.org
@ 2014-06-12 11:25 ` yufeng at gcc dot gnu.org
  2014-06-17  9:40 ` yufeng at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: yufeng at gcc dot gnu.org @ 2014-06-12 11:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483

Yufeng Zhang <yufeng at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.1
      Known to fail|                            |4.8.0, 4.9.0


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

* [Bug target/61483] [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
  2014-06-12 11:23 [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack yufeng at gcc dot gnu.org
  2014-06-12 11:24 ` [Bug target/61483] " yufeng at gcc dot gnu.org
  2014-06-12 11:25 ` yufeng at gcc dot gnu.org
@ 2014-06-17  9:40 ` yufeng at gcc dot gnu.org
  2014-06-17 14:15 ` yufeng at gcc dot gnu.org
  2014-06-17 14:19 ` yufeng at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: yufeng at gcc dot gnu.org @ 2014-06-17  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483

--- Comment #1 from Yufeng Zhang <yufeng at gcc dot gnu.org> ---
Author: yufeng
Date: Tue Jun 17 09:39:22 2014
New Revision: 211733

URL: https://gcc.gnu.org/viewcvs?rev=211733&root=gcc&view=rev
Log:
gcc/

    PR target/61483
    * config/aarch64/aarch64.c (aarch64_layout_arg): Add new local
    variable 'size'; calculate 'size' right in the front; use
    'size' to compute 'nregs' (when 'allocate_ncrn != 0') and
    pcum->aapcs_stack_words.

gcc/testsuite/

    PR target/61483
    * gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type.
    * gcc.target/aarch64/aapcs64/va_arg-13.c: New test.
    * gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto.
    * gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto.

Added:
    trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c
    trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c
    trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h


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

* [Bug target/61483] [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
  2014-06-12 11:23 [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack yufeng at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-06-17  9:40 ` yufeng at gcc dot gnu.org
@ 2014-06-17 14:15 ` yufeng at gcc dot gnu.org
  2014-06-17 14:19 ` yufeng at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: yufeng at gcc dot gnu.org @ 2014-06-17 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483

--- Comment #3 from Yufeng Zhang <yufeng at gcc dot gnu.org> ---
Author: yufeng
Date: Tue Jun 17 14:15:03 2014
New Revision: 211741

URL: https://gcc.gnu.org/viewcvs?rev=211741&root=gcc&view=rev
Log:
gcc/

    PR target/61483
    * config/aarch64/aarch64.c (aarch64_layout_arg): Add new local
    variable 'size'; calculate 'size' right in the front; use
    'size' to compute 'nregs' (when 'allocate_ncrn != 0') and
    pcum->aapcs_stack_words.

gcc/testsuite/

    PR target/61483
    * gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type.
    * gcc.target/aarch64/aapcs64/va_arg-13.c: New test.
    * gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto.
    * gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto.

Added:
   
branches/gcc-4_8-branch/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c
      - copied unchanged from r211733,
trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c
   
branches/gcc-4_8-branch/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c
      - copied unchanged from r211733,
trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c
   
branches/gcc-4_8-branch/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c
      - copied unchanged from r211733,
trunk/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c
Modified:
    branches/gcc-4_8-branch/   (props changed)
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/aarch64/aarch64.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h
    branches/gcc-4_8-branch/libjava/classpath/   (props changed)

Propchange: branches/gcc-4_8-branch/
            ('svn:mergeinfo' modified)

Propchange: branches/gcc-4_8-branch/libjava/classpath/
            ('svn:mergeinfo' modified)


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

* [Bug target/61483] [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
  2014-06-12 11:23 [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack yufeng at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-06-17 14:15 ` yufeng at gcc dot gnu.org
@ 2014-06-17 14:19 ` yufeng at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: yufeng at gcc dot gnu.org @ 2014-06-17 14:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483

Yufeng Zhang <yufeng at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.9.1                       |4.8.4

--- Comment #4 from Yufeng Zhang <yufeng at gcc dot gnu.org> ---
Have fixed the issue in trunk 211733, and backport to 4.9 and 4.8 branches
(211739 and 211741).


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

end of thread, other threads:[~2014-06-17 14:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 11:23 [Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack yufeng at gcc dot gnu.org
2014-06-12 11:24 ` [Bug target/61483] " yufeng at gcc dot gnu.org
2014-06-12 11:25 ` yufeng at gcc dot gnu.org
2014-06-17  9:40 ` yufeng at gcc dot gnu.org
2014-06-17 14:15 ` yufeng at gcc dot gnu.org
2014-06-17 14:19 ` yufeng at gcc dot gnu.org

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