stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-861) [Sun C++ 5.9/x86_64] bad codegen on va_arg and long double
Date Mon, 14 Apr 2008 03:15:04 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588471#action_12588471
] 

Martin Sebor commented on STDCXX-861:
-------------------------------------

Filed a bug with Sun:

-------- Original Message --------
Subject: Your Report (Review ID: 1229484) - Sun C++/x86_64 bad codegen on va_arg and long
double
Date: Sun, 13 Apr 2008 21:12:00 -0600 (MDT)
From: IncidentDaemon@sun.com <IncidentDaemon@sun.com>
To: sebor AT roguewave DOT com


Dear Sun Studio Developer,

Thank you for your interest in improving the quality of Sun Studio 
product.

Your report has been assigned an internal review ID of  1229484.

Please be aware that the large volume of reports we receive sometimes 
prevents us from responding individually to each message.

If the information is determined to be a new Bug or Request for 
Enhancement (RFE), or a duplicate of a known Bug or RFE, you will 
receive a followup email containing a seven digit bug number.  By 
using this seven digit bug number, you may search for, view, or vote 
for this bug in the Bug Database at http://bugs.sun.com/.  Please note 
that we cannot promise to fix all reported bugs.

If you just reported an issue that could have a major impact on your 
project and require a timely response, please consider purchasing 
one of the support offerings described at 
http://developers.sun.com/prodtech/cc/support/support_services.jsp.

The Sun Developer Network (http://developers.sun.com) is a free service 
that Sun offers. To join, visit http://developers.sun.com/global/join_sdn.html.

Regards,
Sun Studio Developer Bug Report Review Team


{noformat}
Date Created: Sun Apr 13 21:10:53 MDT 2008
Type:        bug
Customer Name:   Martin Sebor
Customer Email:  sebor AT roguewave DOT com
SDN ID:       
status:      Waiting
Category:    c++
Subcategory: other
Company:     Rogue Wave Software
release:     studio12
hardware:    x64
OSversion:   solaris_10
priority:    4
Synopsis:    Sun C++/x86_64 bad codegen on va_arg and long double
Description:
 FULL PRODUCT VERSION :


ADDITIONAL OS VERSION INFORMATION :
Solaris 10

A DESCRIPTION OF THE PROBLEM :
Sun C++ 5.9 appears to generate incorrect code for x86_64 (but not for x86 or SPARC) the attached
program involving va_arg() and long double.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
$ cat t.cpp && CC -m64 -V t.cpp && ./a.out
#include <cassert>
#include <cstdarg>
#include <cstdio>
#include <cstring>

char buffer [80];
const char* a1;
int a2;
const char* a3;
int a4;
const char* a5;
long double a6;

void setargs (std::va_list va) {
    a1 = va_arg (va, const char*);
    a2 = va_arg (va, int);
    a3 = va_arg (va, const char*);
    a4 = va_arg (va, int);
    a5 = va_arg (va, const char*);
    a6 = va_arg (va, long double);
}

void foo (const char *fmt, ...) {
    std::va_list va;
    va_start (va, fmt);
    setargs (va);
    std::sprintf (buffer, "%s %x %Lg", a3, a4, a6);
    va_end (va);
}

void bar (char *buf, const char *fmt, ...) {
    std::va_list va;
    va_start (va, fmt);
    setargs (va);
    std::sprintf (buf, "%s %x %Lg", a3, a4, a6);
    va_end (va);
}

int main () {
    char buf [80];

    foo (     "", "", 1, "", 0x12345678, "%Lg", 1.0L);
    bar (buf, "", "", 1, "", 0x12345678, "%Lg", 1.0L);

    std::puts (buffer);
    std::puts (buf);

    assert (0 == std::strcmp (buf, buffer));
    assert (0 == std::strcmp (buf, " 12345678 1"));
}
CC: Sun C++ 5.9 SunOS_i386 Patch 124864-01 2007/07/25
/amd/packages/mdx/solaris/amd64/compilers/sun/C++5.9j1/prod/bin/c++filt: Sun C++
 5.9 SunOS_i386 2007/05/03
ccfe: Sun C++ 5.9 SunOS_i386 Patch 124864-01 2007/07/25
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482
 12345678 1
 12345678 2.60544e-4932
Assertion failed: 0 == std::strcmp (buf, buffer), file t.cpp, line 48
Abort (core dumped)


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
 12345678 1
 12345678 1

ACTUAL -
 12345678 1
 12345678 2.60544e-4932
Assertion failed: 0 == std::strcmp (buf, buffer), file t.cpp, line 48
Abort (core dumped)


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Assertion failed: 0 == std::strcmp (buf, buffer), file t.cpp, line 48
Abort (core dumped)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
#include <cassert>
#include <cstdarg>
#include <cstdio>
#include <cstring>

char buffer [80];
const char* a1;
int a2;
const char* a3;
int a4;
const char* a5;
long double a6;

void setargs (std::va_list va) {
    a1 = va_arg (va, const char*);
    a2 = va_arg (va, int);
    a3 = va_arg (va, const char*);
    a4 = va_arg (va, int);
    a5 = va_arg (va, const char*);
    a6 = va_arg (va, long double);
}

void foo (const char *fmt, ...) {
    std::va_list va;
    va_start (va, fmt);
    setargs (va);
    std::sprintf (buffer, "%s %x %Lg", a3, a4, a6);
    va_end (va);
}

void bar (char *buf, const char *fmt, ...) {
    std::va_list va;
    va_start (va, fmt);
    setargs (va);
    std::sprintf (buf, "%s %x %Lg", a3, a4, a6);
    va_end (va);
}

int main () {
    char buf [80];

    foo (     "", "", 1, "", 0x12345678, "%Lg", 1.0L);
    bar (buf, "", "", 1, "", 0x12345678, "%Lg", 1.0L);

    std::puts (buffer);
    std::puts (buf);

    assert (0 == std::strcmp (buf, buffer));
    assert (0 == std::strcmp (buf, " 12345678 1"));
}

---------- END SOURCE ----------
workaround:  
comments:    (company - Rogue Wave Software , email - sebor AT roguewave DOT com)
{noformat}


> [Sun C++ 5.9/x86_64] bad codegen on va_arg and long double
> ----------------------------------------------------------
>
>                 Key: STDCXX-861
>                 URL: https://issues.apache.org/jira/browse/STDCXX-861
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>            Reporter: Martin Sebor
>
> Sun C++ 5.9 appears to generate incorrect code for x86_64 (but not for x86 or SPARC)
the attached program involving va_arg() and long double.
> {noformat}
> $ cat t.cpp && CC -m64 -V t.cpp && ./a.out
> #include <cassert>
> #include <cstdarg>
> #include <cstdio>
> #include <cstring>
> char buffer [80];
> const char* a1;
> int a2;
> const char* a3;
> int a4;
> const char* a5;
> long double a6;
> void setargs (std::va_list va) {
>     a1 = va_arg (va, const char*);
>     a2 = va_arg (va, int);
>     a3 = va_arg (va, const char*);
>     a4 = va_arg (va, int);
>     a5 = va_arg (va, const char*);
>     a6 = va_arg (va, long double);
> }
> void foo (const char *fmt, ...) {
>     std::va_list va;
>     va_start (va, fmt);
>     setargs (va);
>     std::sprintf (buffer, "%s %x %Lg", a3, a4, a6);
>     va_end (va);
> }
> void bar (char *buf, const char *fmt, ...) {
>     std::va_list va;
>     va_start (va, fmt);
>     setargs (va);
>     std::sprintf (buf, "%s %x %Lg", a3, a4, a6);
>     va_end (va);
> }
> int main () {
>     char buf [80];
>     foo (     "", "", 1, "", 0x12345678, "%Lg", 1.0L);
>     bar (buf, "", "", 1, "", 0x12345678, "%Lg", 1.0L);
>     std::puts (buffer);
>     std::puts (buf);
>     assert (0 == std::strcmp (buf, buffer));
>     assert (0 == std::strcmp (buf, " 12345678 1"));
> }
> CC: Sun C++ 5.9 SunOS_i386 Patch 124864-01 2007/07/25
> /amd/packages/mdx/solaris/amd64/compilers/sun/C++5.9j1/prod/bin/c++filt: Sun C++ 5.9
SunOS_i386 2007/05/03
> ccfe: Sun C++ 5.9 SunOS_i386 Patch 124864-01 2007/07/25
> ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482
>  12345678 1
>  12345678 2.60544e-4932
> Assertion failed: 0 == std::strcmp (buf, buffer), file t.cpp, line 48
> Abort (core dumped)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message