[Bug c/23106] New: -Wstrict-aliasing=2 doesn't warn for all aliasing problems

2005-07-27 Thread fn_x at hotmail dot com
Hi,

This program:

int main() {
int a = 1;

* (short *) (char *) &a = 2;

char *p = (char *) &a;
* (short *) p = 3;

return a;
}

returns 1 when compiled with gcc 4.0.1 (nothing more is necessary than gcc -O2
test.c). However, adding -Wstrict-aliasing=2 does not make any warning for this
show up. This happens with void * as well.

I first asked about the first case on gcc-help, and Ian Lance Taylor followed up
with a patch to show a warning:
http://gcc.gnu.org/ml/gcc-help/2005-07/msg00292.html
For the second case, he asked to open a bug here.

-- 
   Summary: -Wstrict-aliasing=2 doesn't warn for all aliasing
problems
   Product: gcc
   Version: 4.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: fn_x at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


[Bug c/23106] -Wstrict-aliasing=2 doesn't warn for all aliasing problems

2005-07-27 Thread fn_x at hotmail dot com

--- Additional Comments From fn_x at hotmail dot com  2005-07-28 00:00 
---
The bug this is marked a duplicate of is about -Wall, which includes only
-Wstrict-aliasing. This bug is about -Wstrict-aliasing=2. It is documented as
warning for "all code which might break the strict aliasing rules that the
compiler is using for optimization". I certainly agree that it is reasonable not
to warn when only -Wstrict-aliasing is given, but if you don't want to warn here
either, would it be fair to ask to at least update the documentation?

-- 


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


[Bug c/23106] -Wstrict-aliasing=2 doesn't warn for all aliasing problems

2005-07-27 Thread fn_x at hotmail dot com

--- Additional Comments From fn_x at hotmail dot com  2005-07-28 05:26 
---
Consider this reopened as a documentation bug, then, as it is currently clearly
documented that the second case will get a warning with -Wstrict-aliasing=2.

-- 
   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |


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


[Bug c++/23385] New: gcc accepts "class typedefname" when typedefname is defined in a nested class and references a template parameter

2005-08-14 Thread fn_x at hotmail dot com
Hello,

All versions of gcc I tried (2.95.3, 3.3.6, 3.4.4, 4.0-20050811, and
4.1-20050813) accept this code without any warnings or errors (using -ansi
-pedantic -Wall -W, just in case)

template
class A {
struct helper { typedef T type; };
friend class helper::type;
};
class B { A m; } b;
int main() {}

I don't believe this code is valid. icc 9.0.021 rejects this code with

error: typedef "type" may not be used in an elaborated type specifier

and gcc 4.0-20050811 rejects it when I try the same thing with A::type,
rather than A::helper::type, with

error: using template type parameter ‘T’ after ‘class’

Additionally, any attempts at using "class A::helper::type" outside of the
template definition result in

error: using typedef-name ‘A::helper::type’ after ‘class’

So I think my code should result in either of the above two errors as well.

I can't find any other reports of this, but sorry if I missed anything.

-- 
   Summary: gcc accepts "class typedefname" when typedefname is
defined in a nested class and references a template
parameter
   Product: gcc
   Version: 4.0.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: fn_x at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


[Bug c++/23385] gcc accepts "class typedefname" when typedefname is defined in a nested class and references a template parameter

2005-08-14 Thread fn_x at hotmail dot com

--- Additional Comments From fn_x at hotmail dot com  2005-08-14 16:48 
---
Yeah, this is just slightly different code, but it is covered by that bug's
summary and description. Sorry for the noise.

*** This bug has been marked as a duplicate of 21498 ***

-- 
   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE


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


[Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced

2005-08-14 Thread fn_x at hotmail dot com

--- Additional Comments From fn_x at hotmail dot com  2005-08-14 16:48 
---
*** Bug 23385 has been marked as a duplicate of this bug. ***

-- 
   What|Removed |Added

 CC||fn_x at hotmail dot com


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


[Bug c/26494] New: -pedantic-errors can be overridden by -W*

2006-02-28 Thread fn_x at hotmail dot com
This simple incorrect program:

int main() { puts("Hello"); }

when compiled with gcc -std=c99 -pedantic-errors is rejected with

test.c: In function ‘main’:
test.c:1: error: implicit declaration of function ‘puts’

However, add -Wall to the options, and it becomes:

test.c: In function ‘main’:
test.c:1: warning: implicit declaration of function ‘puts’

and the program compiles and runs without errors. I think gcc should not
compile it. Also, reordering the options doesn't change anything.

Given how old this is (I can see it with gcc 3.3.6, 3.4.5, 4.0.2 and
4.1(20060223)), I'm a bit surprised if it hasn't come up before, but I searched
bugzilla and didn't find anything. Sorry for anything I missed.


-- 
   Summary: -pedantic-errors can be overridden by -W*
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: fn_x at hotmail dot com


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



[Bug c/18493] New: gcc doesn't like switch blocks without case/default labels

2004-11-14 Thread fn_x at hotmail dot com
Hi,

int main() {
goto bug;
switch(0) {
bug: return 0;
}
}

This program doesn't compile with gcc 3.4.3. It gives this error message:
/tmp/ccetXBGt.o(.text+0x1d): In function `main':
: undefined reference to `.L2'

However, this:

int main() {
goto bug;
switch(0) {
bug: return 0;
default: ;
}
}

does compile without a problem.

gcc 2.95.3 and 3.3.4 compile both examples.

I searched to see if anyone else reported this, and only found bug #17078. I
don't know if it's related or just similar. Sorry if I overlooked another bug
report.

-- 
   Summary: gcc doesn't like switch blocks without case/default
labels
   Product: gcc
   Version: 3.4.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: fn_x at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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