c++.beta - [bug] dmc.8.48.9: internal error cgreg 371
- Nic Tiger (21/21) May 12 2006 internal error cgreg 371
- Heinz Saathoff (7/16) May 14 2006 ^^^^^^^^^^^
- Nic Tiger (2/24) May 15 2006 Thanks! Didn't seen it earlier
internal error cgreg 371 when compiling following code with dmc -o+speed dirTree.cpp error goes off when 1) no optimization 2) no use of sprintf 3) no use of for -------- dirTree.cpp ----------- #include <stdio.h> static inline char *make_path ( const char *base, const char *fname ) { static char buf[260]; _snprintf ( buf, sizeof(buf), "%s/%s", base, fname ); buf[sizeof(buf)] = '\0'; return buf; } bool walk_dir_tree ( const char *root_dir, int wildcard_num, const char **wildcards ) { for ( int i = 0; i < wildcard_num; i ++ ) make_path ( root_dir, wildcards[i] ); return true; }
May 12 2006
Hello, Nic Tiger wrote...-------- dirTree.cpp ----------- #include <stdio.h> static inline char *make_path ( const char *base, const char *fname ) { static char buf[260]; _snprintf ( buf, sizeof(buf), "%s/%s", base, fname ); buf[sizeof(buf)] = '\0';^^^^^^^^^^^ Indexing one behind last element. I don't think the compiler will show internal error because of this, but who knows ;-)return buf; }- Heinz
May 14 2006
Heinz Saathoff wrote:Hello, Nic Tiger wrote...Thanks! Didn't seen it earlier-------- dirTree.cpp ----------- #include <stdio.h> static inline char *make_path ( const char *base, const char *fname ) { static char buf[260]; _snprintf ( buf, sizeof(buf), "%s/%s", base, fname ); buf[sizeof(buf)] = '\0';^^^^^^^^^^^ Indexing one behind last element. I don't think the compiler will show internal error because of this, but who knows ;-)return buf; }- Heinz
May 15 2006