Menu

#369 gcc 3.2.X .. _findfirst from io.h nasty bug

OTHER
closed
rejected
component_package
2013-01-24
2003-06-13
No

I've tried with the following compilers (on winxp), both
with similar (slightly different .. STRANGE runtime
behaviour) .. both compilers compiled the below code.

* gcc (GCC) 3.2 (mingw special 20020817-1)
* gcc (GCC) 3.2.3 (mingw special 20030504-1)

BUG behaviour

w/ 3.2:
* when 2,3,4...,13,..? variables (any var, i think) is
declared before _findfirst, _findfirst crashes.
* when 1 variable is declared (before _findfirst), it
seems to work

w/ 3.2.3
* always seems to crash, even when no variables are
declared.

SAMPLE CODE: .. this code compiles, but crashes on the
_findfirst function call for me, every time, using gcc 3.2.3

the code "should" return the first found file in the c:\
directory.

__BUG_TEST_CODE - for GCC 3.2.3__

#include <io.h>
main () {

// int a, b; // uncomment this for gcc 3.2 test

struct \_finddata\_t \* asdf;
\_findfirst \("c:/\*", asdf\);
printf \("%s",asdf->name\);

}

Discussion

  • Anonymous

    Anonymous - 2003-06-13

    Logged In: YES
    user_id=800187

    i tested a few more cases .. again, compiling using gcc (GCC)
    3.2.3 (mingw special 20030504-1),

    apparantly, declaring 0-8 variables before _finddata crashes
    each time, but declaring 9 variables:

    int a1, a2, a3, a4, a5, a6, a7, a8, a9;
    

    works =) .. so, as a *temporary* solution, one must declare 9
    variables (any type) before the _findfirst function call =(

     
  • Danny Smith

    Danny Smith - 2003-06-14
    • status: open --> closed-rejected
     
  • Danny Smith

    Danny Smith - 2003-06-14

    Logged In: YES
    user_id=11494

    Your code is buggy. You didn't allocate the _finddata_t
    buffer.

    #include <io.h>
    int main () {

    struct _finddata_t asdf;
    _findfirst ("c:/*", &asdf);
    printf ("%s",asdf.name);
    return 0;
    }

     
  • Earnie Boyd

    Earnie Boyd - 2013-01-24
    • labels: gcc --> gcc, user code
    • status: closed-rejected --> closed
    • resolution: --> rejected
    • category: --> component_package
    • milestone: --> OTHER