You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/04/14 05:11:05 UTC
[jira] Created: (STDCXX-861) [Sun C++ 5.9/x86_64] bad codegen on
va_arg and long double
[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.
[jira] Commented: (STDCXX-861) [Sun C++ 5.9/x86_64] bad codegen on
va_arg and long double
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588605#action_12588605 ]
Martin Sebor commented on STDCXX-861:
-------------------------------------
-------- Original Message --------
Subject: Re: (Incident Review ID: 1229484) Sun C++/x86_64 bad codegen on va_arg and long double
Date: Mon, 14 Apr 2008 08:03:53 -0700 (MST)
From: Steve Clamage <Stephen.Clamage AT Sun DOT COM>
To: sebor AT roguewave DOT com
Hi Martin Sebor,
Thank you for reporting this issue.
We have determined that this report is a new bug and entered the bug into our internal bug tracking system under Bug Id: 6688168.
You can monitor this bug on the Java Bug Database at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6688168.
It may take a day or two before your bug shows up in this external database. If you are a member of the Sun Developer Network (SDN), there are two additional options once the bug is visible.
1. Voting for the bug
Click http://bugs.sun.com/bugdatabase/addVote.do?bug_id=6688168.
2. Adding the report to your Bug Watch list.
You will receive an email notification when this bug is updated.
Click http://bugs.sun.com/bugdatabase/addBugWatch.do?bug_id=6688168.
The Sun Developer Network (http://developers.sun.com) is a free service that Sun offers. To join, visit https://softwarereg.sun.com/registration/developer/en_US/new_user.
For a limited time, SDN members can obtain fully licensed Java IDEs for web and enterprise development. More information is at http://developers.sun.com/prodtech/javatools/free/.
> [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.
[jira] Commented: (STDCXX-861) [Sun C++ 5.9/x86_64] bad codegen on
va_arg and long double
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ 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 <In...@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.