www.digitalmars.com         C & C++   DMDScript  

c++.beta - [bug] dmc.8.48.9: internal error cgreg 371

reply Nic Tiger <g_tiger progtech.ru> writes:
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
parent reply Heinz Saathoff <newshsaat arcor.de> writes:
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
parent Nic Tiger <g_tiger progtech.ru> writes:
Heinz Saathoff wrote:
 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
Thanks! Didn't seen it earlier
May 15 2006