This is the mail archive of the gcc-prs@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]

c++/9880: setprecision() strange behaviour


>Number:         9880
>Category:       c++
>Synopsis:       setprecision()  strange behaviour
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 27 17:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Alberto Ribon
>Release:        gcc 3.2 (and others...)
>Organization:
>Environment:
various:  Red Hat Linux 7.3   gcc 3.2
          SuSE    Linux 7.2   gcc 3.2 
          Red Hat Linux 7.3   gcc 2.95.2
          Red Hat Linux 7.3   gcc 2.96 
          Red Hat Linux 6.1   egcs 2.91.66
          SunOS 5.7           CC Sun WorkShop 6 update 1 C++ 5.2 Patch 109508-02   
          SunOS 5.7           CC Forte Developer 7 C++ 5.4 Patch 111715-02
         
>Description:
Using setprecision(n) with n>= 16 in a cout statement
causes an unexpected behaviour in following cout
statements (without explicit use of setprecision) 
under certain circumstances. Look at the attached code
sample.
>How-To-Repeat:
Just build and run it!
>Fix:
If you use  setprecision( n )  with  n <= 15 , or not
use setprecision at all (which means to use the default n=6)
then it's OK.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.cc"

Ly8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KLy8gMjctRmViLTIwMDIgICoqKiAgUHJvYmxl
bSB3aXRoICBzdGQ6OnNldHByZWNpc2lvbiggbiApICAqKioKLy8KLy8gICAgICAgICAgICAgIEZv
ciBzZXRwcmVjaXNpb24obikgIHdpdGggbiA8IDE2IGV2ZXJ5dGhpbmcgaXMgT0ssIHRoZSBvdXRw
dXQgYmVpbmc6Ci8vICAgICAgICAgICAgICAgICAgICAgSGVsbG8gd29ybGQhCi8vCi8vICAgICAg
ICAgICAgICAgICAgICAgeDEgPSA0LjQ0NDgKLy8gICAgICAgICAgICAgICAgICAgICB4MiA9IDQu
NDQ0Ci8vCi8vICAgICAgICAgICAgICAgICAgICAgeTEgPSA1LjU1NTUKLy8gICAgICAgICAgICAg
ICAgICAgICB5MiA9IDUuNTU1Ci8vCi8vICAgICAgICAgICAgICAgICAgICAgejEgPSA2LjY2NzIK
Ly8gICAgICAgICAgICAgICAgICAgICB6MiA9IDYuNjY2Ci8vCi8vICAgICAgICAgICAgICBGb3Ig
biA+PSAxNiB5b3UgZ2V0IGEgc3RyYW5nZSAod3JvbmcpIHJlc3VsdCwgdGhlIG91dHB1dCBiZWlu
ZzoKLy8gICAgICAgICAgICAgICAgICAgICBIZWxsbyB3b3JsZCEKLy8KLy8gICAgICAgICAgICAg
ICAgICAgICB4MSA9IDQuNDQ0OAovLyAgICAgICAgICAgICAgICAgICAgIHgyID0gNC40NDQKLy8K
Ly8gICAgICAgICAgICAgICAgICAgICB5MSA9IDUuNTU1NDk5OTk5OTk5OTk5Ci8vICAgICAgICAg
ICAgICAgICAgICAgeTIgPSA1LjU1NTAwMDAwMDAwMDAwMQovLwovLyAgICAgICAgICAgICAgICAg
ICAgIHoxID0gNi42NjcyCi8vICAgICAgICAgICAgICAgICAgICAgejIgPSA2LjY2NTk5OTk5OTk5
OTk5OQovLwovLyAgICAgICAgICAgICAgVGhpcyBoYXBwZW5zIGluIHRoZSBmb2xsb3dpbmcgcGxh
dGZvcm1zOgovLyAgICAgICAgICAgICAgICAtLS0gUmVkIEhhdCBMaW51eCA3LjMgICBnY2MgMy4y
Ci8vICAgICAgICAgICAgICAgIC0tLSBTdVNFICAgIExpbnV4IDcuMiAgIGdjYyAzLjIgCi8vICAg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g
eTEgPSA1LjU1NTsKICB5MSA9IHkxICsgMC4wMDA1OwogIGRvdWJsZSB5MiA9IDUuNTU1NTsKICB5
MiA9IHkyIC0gMC4wMDA1OwoKICBkb3VibGUgejEgPSA2LjY2NjY7CiAgejEgPSB6MSArIDAuMDAw
NjsKICBkb3VibGUgejIgPSA2LjY2NjY7CiAgejIgPSB6MiAtIDAuMDAwNjsKCiAgc3RkOjpjb3V0
IDw8ICIgeDEgPSAiIDw8IHgxIDw8IHN0ZDo6ZW5kbAoJICAgIDw8ICIgeDIgPSAiIDw8IHgyIDw8
IHN0ZDo6ZW5kbCAKICAgICAgICAgICAgPDwgc3RkOjplbmRsCiAgICAgICAgICAgIDw8ICIgeTEg
PSAiIDw8IHkxIDw8IHN0ZDo6ZW5kbAoJICAgIDw8ICIgeTIgPSAiIDw8IHkyIDw8IHN0ZDo6ZW5k
bAogICAgICAgICAgICA8PCBzdGQ6OmVuZGwKICAgICAgICAgICAgPDwgIiB6MSA9ICIgPDwgejEg
PDwgc3RkOjplbmRsCgkgICAgPDwgIiB6MiA9ICIgPDwgejIgPDwgc3RkOjplbmRsCiAgICAgICAg
ICAgIDw8IHN0ZDo6ZW5kbDsKCiAgcmV0dXJuIDA7Cn0KCgo=


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