Message-Id: <199604181352.JAA16827@delorie.com> Date: Thu, 18 Apr 96 16:36:28 LIT From: Martynas Kunigelis Subject: GCC bug To: DJGPP mailing list I know this is not DJGPP related, but seems like I am not able to report bugs directly to FSF, since my messages come back with a weird note, kind of "unknown mailer". Well, guess that's what I have to pay for using VMS these days. Anyway.. I found that if I declare a function like this: void foo(int a, int b, int c, int d) __attribute__ ((regparm(3), stdcall)); then the `stdcall' attribute overrides `regparm', i.e. the function returns with an `rtd' instruction, but parameters are passed through stack as usual. If I swap the attributes in the declaration [ ((stdcall, regparm(3))) ], `regparm' overcomes `stdcall', i.e. a, b, and c are passed in registers. but the function returns with a usual `ret' instruction. However, if I compile with -mregparm=3 and -mrtd options, everything's OK, i.e. a, b and c are passed in registers and the function returns with an `rtd $4' instruction. I think those two attributes combioned with the -fomit-frame-pointer option could result in *very* optimal code, thus GCC behaviour with __attribute__ missatisfies me. I consider this a bug, because if it wasn't, the stuff would not work with cmd. line options either. Now, can anyone PLEASE report this to bug-gcc AT prep DOT ai DOT mit DOT edu for me [and all of us]?? I really have no way to do this.. P.S. I think it is a *very* good idea to add some new option to gcc by editing the `specs' file which, once specified, would involve: -mregparm=3 -mrtd -fomit-frame-pointer -Wimplicit -D__FASTCALL__ and also appropriate libs and startup files. The C library [and others] could be recompiled with the new calling convention ( asm parts should check for the __FASTCALL__ macro). The code resulting from this would BLOW *any* other known compilers in terms of speed. Good idea, eh?. Charlie? Martynas