public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/29543] New: [gdb/tdep] inferior call with complex long double vararg not handled correctly
Date: Fri, 02 Sep 2022 13:00:45 +0000	[thread overview]
Message-ID: <bug-29543-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29543

            Bug ID: 29543
           Summary: [gdb/tdep] inferior call with complex long double
                    vararg not handled correctly
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Spinoff from PR29247 comment 23. ]

On a powerpc system with gcc 12 built to default to 128-bit IEEE long double, I
run into:
...
(gdb) print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)^M
$8 = 0 + 0i^M
(gdb) FAIL: gdb.base/varargs.exp: print find_max_long_double_real(4, ldc1,
ldc2, ldc3, ldc4)
...

I've minimized this to:
...
$ cat gdb/testsuite/gdb.base/varargs.c
#include <stdarg.h>
#include <stdlib.h>

long double _Complex orig = 4.0L + 4.0Li;
long double _Complex copy = 0L + 0Li;

int
test (void)
{
  return 0;
}

void
do_copy (int num_vals, ...)
{
#if 1
  va_list argp;
  va_start (argp, num_vals);
  copy = va_arg (argp, long double _Complex);
#else
  copy = orig;
#endif
}

void
_start (void)
{
  test ();

  while (1)
    ;
}
...
and:
...
$ cat gdb/testsuite/gdb.base/varargs.exp
standard_testfile .c

set additional_flags {debug}
lappend additional_flags "additional_flags=-nostdlib"

if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
           executable ${additional_flags}] != "" } {
     untested "failed to compile"
     return -1
}

clean_restart ${binfile}

gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"

runto test

gdb_test "print orig" ".*= 4 \\+ 4i"
gdb_test "print copy" ".*= 0 \\+ 0i"

gdb_test "print do_copy (1, orig)"

with_test_prefix "after copy" {
    gdb_test "print orig" ".*= 4 \\+ 4i"
    gdb_test "print copy" ".*= 4 \\+ 4i"
}
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-09-02 13:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 13:00 vries at gcc dot gnu.org [this message]
2022-09-02 13:07 ` [Bug tdep/29543] " vries at gcc dot gnu.org
2022-09-02 13:10 ` [Bug tdep/29543] [gdb/tdep, ppc] " vries at gcc dot gnu.org
2022-09-02 13:16 ` vries at gcc dot gnu.org
2022-09-02 13:26 ` [Bug tdep/29543] [gdb/tdep, ppc] inferior call with " vries at gcc dot gnu.org
2022-09-02 15:14 ` vries at gcc dot gnu.org
2022-09-04  7:49 ` vries at gcc dot gnu.org
2022-09-04  7:56 ` vries at gcc dot gnu.org
2022-09-05 16:23 ` uweigand at gcc dot gnu.org
2022-09-06  5:44 ` vries at gcc dot gnu.org
2022-09-07 12:10 ` uweigand at gcc dot gnu.org
2022-09-07 13:46 ` vries at gcc dot gnu.org
2022-09-07 15:33 ` cel at us dot ibm.com
2022-09-07 17:16 ` vries at gcc dot gnu.org
2022-09-07 18:22 ` cel at us dot ibm.com
2022-09-12  9:05 ` vries at gcc dot gnu.org
2022-09-16 15:12 ` vries at gcc dot gnu.org
2022-09-16 16:38 ` cel at us dot ibm.com
2022-11-15  0:55 ` cel at us dot ibm.com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29543-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).