Windows Vista Problems with access() and printf("%n", ...)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Windows Vista Problems with access() and printf("%n", ...)


I tried to file this as bug in the bug tracker, but I cannot log onto
sourceforge. I registered, got a user ID and password, but it says
something like "wrong user id or password".

So I mail the problems I encountered here:

I am trying to compile and use GCC 4.1.0 on Windows Vista.

access() does not work on Vista
When using a version compiled on XP, one has to add the path to CC1 to the
PATH environment variable.
This is not a good solution.
Debugging into gcc I found that in gcc.c in the function process_command()
the relative path returned by make_relative_prefix is OK.
But then the function access (defined in io.h) fails.
I made a separate test program:

    #include <stdio.h>
    int main()
      if (0==access("c:/mygcc/libexec/gcc/i386-elf/4.1.0/cc1.exe",1))
        printf("can access");
        printf("cannot access");
      return 0;

This returns "cannot access" under Vista, but "can access" under XP. The
path is OK and the same on both PCs.
When debugging there is also a "warning: Invalid parameter passed to C
runtime function" under Vista.

printf with %n fails on Vista
When trying to compile GCC I found that min-insn-modes.c and insn-modes.c
get huge and finally lead to a "disk full".
The reason was in in the genmodes.c,  emit_mode_class(), tagged_printf
macro. It calls printf with %n.
The behavior was that for some calls it only didn't return the value for
%n, but then it suddenly started printing blanks until disk fill.

The following test program works on XP, but does not on Vista, i.e. count_
is not updated.

    #include <stdio.h>
    int main()
      int count_=20;
      int i;
#define SC 2
      char* astr[SC]={"my","test"};

      for (i=0;i<SC;++i)
        printf("\ncount was %i\n",count_);
      return 0;

cheers, Roland
[hidden email]

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
MinGW-patches mailing list
[hidden email]