- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given a variable with global scope, icc doesn't complain when a local variable shadows it.
gcc correctly complains.
(This is true in icc 12.0.0)
$ icc -c foo3.c -Wshadow
$ gcc -c foo3.c -Wshadow
foo3.c: In function foo:
foo3.c:2: warning: declaration of a shadows a global declaration
foo3.c:1: warning: shadowed declaration is here
foo3.c:3: warning: declaration of b shadows a global declaration
foo3.c:1: warning: shadowed declaration is here
$ cat foo3.c
int a,b;
int foo (int a) {
int b=a;
return b;
}
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bradley,
I can reprodcue this case here, and I will submit this issue to our engineering team to investigate it more.
Thanks,
Wise
I can reprodcue this case here, and I will submit this issue to our engineering team to investigate it more.
Thanks,
Wise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FYI...This issue had been fixed in compiler v14.0 and latest v15.0, see below:
# cat temp.cpp int a,b; int foo (int a) { int b=a; return b; } # source /opt/intel/composer_xe_2013.1.117/bin/compilervars.sh intel64 # icc -v icc version 13.0.1 (gcc version 4.7.0 compatibility) # icc -c temp.cpp -Wshadow # source /opt/intel/composer_xe_2013_sp1.1.106/bin/compilervars.sh intel64 # icc -v icc version 14.0.1 (gcc version 4.8.0 compatibility) # icc -c temp.cpp -Wshadow temp.cpp(3): warning #3280: declaration hides variable "a" (declared at line 1) int foo (int a) { ^ temp.cpp(5): warning #3280: declaration hides variable "b" (declared at line 1) int b=a; ^ # source /opt/intel/composer_xe_2015.1.133/bin/compilervars.sh intel64 # icc -v icc version 15.0.1 (gcc version 4.8.1 compatibility) # icc -c temp.cpp -Wshadow temp.cpp(3): warning #3280: declaration hides variable "a" (declared at line 1) int foo (int a) { ^ temp.cpp(5): warning #3280: declaration hides variable "b" (declared at line 1) int b=a; ^ #

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page