digitalmars.D.bugs - incorrect "switch statement is not reachable" for large switch statements
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (33/34) Oct 03 2005 -----BEGIN PGP SIGNED MESSAGE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
http://dstress.kuehne.cn/benchmark/known_gcc_problems/gcc_7344.d
- -----------------------------------------------------
int f(){
        printf("F\n");
        return 0;
}
int main(char[][] args) {
        if(args.length<1){
                c: return 0;
        }
        switch (args.length) { // **line 20**
                case 1: f(); goto c;
                case 2: f(); goto c;
                case 3: f(); goto c;
[...]
                case 9999: f(); goto c;
                case 10000: f(); goto c;
        }
}
- -----------------------------------------------------
dmd -w gcc_7344.d
warning - gcc_7344.d(20): switch statement has no default
warning - gcc_7344.d(20): statement is not reachable
warning - gcc_7344.d(16): function dstress.benchmark.gcc_7344.main no
return at end of function
Adding a default case removes the "not reacheable" warning.
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFDQXPb3w+/yD4P9tIRAmYBAJ9sr01XFP83oUZhSDpR4hrLo/2MIgCfRzQN
KAPKJ6w+iL9UiBcCTql9zYg=
=VH+Q
-----END PGP SIGNATURE-----
 Oct 03 2005








 
  
  
  =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn>
 =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn>