[Bug c++/31960] New: Premature hiding of symbols makes a copy constructor shooting at its own foot

2007-05-16 Thread waldemar dot rachwal at gmail dot com
surprise
make -B EXTFLAGS='-O1'  # warnings, but compiles (why it has anything with -O1
?!)
#endif

#if 0 // # g++ (GCC) 4.1.1 [sun4u] ###

// int n = n + 1;
n ==> 67481

// double r = r + 1000.0;
r ==> 1.96794e+307

// X obj;
this ==> 0xffbfefc8
//   X obj(obj);
&rhs ++> 0xffbfefc4 <** UNEXPECTED
this oo> 0xffbfefc4
// X obj(obj);
&rhs ++> 0xffbfefc0 <** UNEXPECTED
this oo> 0xffbfefc0
~obj ~~> 0xffbfefc0
~obj ~~> 0xffbfefc4
~obj ~~> 0xffbfefc8

// X *ptr = new X(*ptr);
&rhs ++> 0
this oo> 0x214d8
~obj ~~> 0x214d8
#endif

#if 0 // # g++ (GCC) 3.4.4 [cygwin] ##

// int n = n + 1;
n ==> 1628302664

// double r = r + 1000.0;
r ==> 1000

// X obj;
this ==> 0x22ccb0
//   X obj(obj);
&rhs ++> 0x22cca0   <** UNEXPECTED
this oo> 0x22cca0
// X obj(obj);
&rhs ++> 0x22cc90       <** UNEXPECTED
this oo> 0x22cc90
~obj ~~> 0x22cc90
~obj ~~> 0x22cca0
~obj ~~> 0x22ccb0

// X *ptr = new X(*ptr);
&rhs ++> 0x4
this oo> 0x6c0768
~obj ~~> 0x6c0768
#endif


-- 
   Summary: Premature hiding of symbols makes a copy constructor
shooting at its own foot
   Product: gcc
   Version: 4.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: waldemar dot rachwal at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31960



[Bug c++/31961] New: Premature hiding of symbols makes a copy constructor shooting at its own foot

2007-05-16 Thread waldemar dot rachwal at gmail dot com
surprise
make -B EXTFLAGS='-O1'  # warnings, but compiles (why it has anything with -O1
?!)
#endif

#if 0 // # g++ (GCC) 4.1.1 [sun4u] ###

// int n = n + 1;
n ==> 67481

// double r = r + 1000.0;
r ==> 1.96794e+307

// X obj;
this ==> 0xffbfefc8
//   X obj(obj);
&rhs ++> 0xffbfefc4 <** UNEXPECTED
this oo> 0xffbfefc4
// X obj(obj);
&rhs ++> 0xffbfefc0 <** UNEXPECTED
this oo> 0xffbfefc0
~obj ~~> 0xffbfefc0
~obj ~~> 0xffbfefc4
~obj ~~> 0xffbfefc8

// X *ptr = new X(*ptr);
&rhs ++> 0
this oo> 0x214d8
~obj ~~> 0x214d8
#endif

#if 0 // # g++ (GCC) 3.4.4 [cygwin] ##

// int n = n + 1;
n ==> 1628302664

// double r = r + 1000.0;
r ==> 1000

// X obj;
this ==> 0x22ccb0
//   X obj(obj);
&rhs ++> 0x22cca0   <** UNEXPECTED
this oo> 0x22cca0
// X obj(obj);
&rhs ++> 0x22cc90       <** UNEXPECTED
this oo> 0x22cc90
~obj ~~> 0x22cc90
~obj ~~> 0x22cca0
~obj ~~> 0x22ccb0

// X *ptr = new X(*ptr);
&rhs ++> 0x4
this oo> 0x6c0768
~obj ~~> 0x6c0768
#endif


-- 
   Summary: Premature hiding of symbols makes a copy constructor
shooting at its own foot
   Product: gcc
   Version: 4.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: waldemar dot rachwal at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31961



[Bug c++/31960] Premature hiding of symbols makes a copy constructor shooting at its own foot

2007-06-06 Thread waldemar dot rachwal at gmail dot com


--- Comment #3 from waldemar dot rachwal at gmail dot com  2007-06-06 09:44 
---
[3 weeks went by, but i've not forgotten about my bug report ;]

as about the last comment (#2) I can't fully agree. -Winit-self works, but only
in case of builtin scalar data types. For objects the compiler is almost quiet.

Please don't misunderstand me: I don't really want any options to signal a
warning on self-initializers (more options, much headache). I really expect
well defined, desirable semantics for such constructs because there are cases
they are very helpful. Of course, if the current standard says nothing about
this or leave up to implementors, and we want to have G++ semantics here
defined, there is a room for some options in the meantime until the standard
becomes definite.

Please note that scripting languages are well defined here. Below is a simple
Perl code (strictness checks if vars are defined, while -w option add extra
warning level).

Regards,
WR.

$ perl -Mstrict -e 'my $z = 1; my $z = $z + 1; print "$z\n"'
2
$ perl -w -Mstrict -e 'my $z = 1; my $z = $z + 1; print "$z\n"' 
"my" variable $z masks earlier declaration in same scope at -e line 1.
2


-- 

waldemar dot rachwal at gmail dot com changed:

   What|Removed |Added
--------
     CC||waldemar dot rachwal at
   ||gmail dot com
 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31960