c++/435: incorrect treatment of ++ operator

bland@japan.com bland@japan.com
Fri Jul 28 00:26:00 GMT 2000


>Number:         435
>Category:       c++
>Synopsis:       incorrect treatment of ++ operator
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 28 00:26:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     bland@japan.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
The sample attached prints 2 instead of 1. This behaviour is different from x86 codegen.
We are using:
%uname -a
SunOS leo 5.6 Generic_105181-19 sun4u sparc SUNW,Ultra-5_10
%gcc --version
2.95.2


>How-To-Repeat:
Compile sample on sparc platform.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="bug.cxx"
Content-Disposition: inline; filename="bug.cxx"

#include <iostream>
#include <vector>


int
main (void)
{
  vector<unsigned char> v;
  const char* s = "12345";

  v.push_back (*s++);

  cerr << v[0] << endl;

  return 0;
}


More information about the Gcc-prs mailing list