public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* __attribute__((dllimport)) on func defn gives internal error
@ 1999-07-01  4:19 Olly Betts
  1999-07-02 21:49 ` Mumit Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Olly Betts @ 1999-07-01  4:19 UTC (permalink / raw)
  To: egcs-bugs

If I try to compile this one line C source file:

__attribute__((dllimport)) int foo(int x) { return 0; }

with egcs 1.1.2 (built as a linux->mingw cross compiler) I get:

../../gcc/toplev.c:3859: Internal compiler error in function rest_of_compilation

My example code is clearly nonsense - dllimport only makes sense on a
declaration, not a definition (I encountered this when I had dllexport and
dllimport switched in my header file).  But this shouldn't result in an
internal compiler error.

Cheers,
Olly
>From Roger.Kommer@micromata.de Thu Jul 01 04:38:00 1999
From: "Roger Rene Kommer" <Roger.Kommer@micromata.de>
To: <egcs-bugs@egcs.cygnus.com>
Subject: egcs C++ bug
Date: Thu, 01 Jul 1999 04:38:00 -0000
Message-id: <000001bebb11$4fc37400$2df0dad4@micromata.de>
X-SW-Source: 1999-07/msg00013.html
Content-length: 234

Hi,

Look at the very simple code in CompilerTest.cpp.
I'm quite sure, that this is legal code.
I've also tested in on the linux plattform (same version of egcs) with the
same result.

Regards,
Roger Rene Kommer
kommer@artefaktur.com
>From nathan@cs.hmc.edu Thu Jul 01 06:54:00 1999
From: Nathan Field <nathan@cs.hmc.edu>
To: Jeffrey A Law <law@cygnus.com>
Cc: egcs-bugs@egcs.cygnus.com
Subject: Re: Build of snapshots failed on Solaris 2.6 
Date: Thu, 01 Jul 1999 06:54:00 -0000
Message-id: <Pine.GSO.4.10.9907010639420.23506-100000@turing.cs.hmc.edu>
References: <27837.930814227@upchuck.cygnus.com>
X-SW-Source: 1999-07/msg00014.html
Content-length: 2361

This compile was done with:
(27) nathan@turing /proj/nathan/egcs/objdir-turing/gcc -> gcc -v
Reading specs from
/usr/local/gcc-2.8.1/lib/gcc-lib/sparc-sun-solaris2.5.1/2.8.1/specs
gcc version 2.8.1


>   > The error I'm getting is:
>   > 
>   > ./gengenrtl tmp-genrtl.h tmp-genrtl.c
>   > gmake[2]: *** [s-genrtl] Segmentation Fault
>   > gmake[2]: Leaving directory `/export/proj/nathan/egcs/objdir-turing/gcc'
>   > gmake[1]: *** [bootstrap] Error 2
>   > gmake[1]: Leaving directory `/export/proj/nathan/egcs/objdir-turing/gcc'
>   > gmake: *** [bootstrap] Error 2
> I recommend you start up gdb on gengenrtl and run it to see where it is 
> dying.
Ok, I'm not a gdb wizard, but here's what I've figured out.

First off, some context, here's the backtrace:

#0  0x9de3bf90 in ?? ()
#1  0x10aa0 in gendecl (f=0x23040, format=0x12379 "e")
    at ../../egcs-19990623/gcc/gengenrtl.c:179
#2  0x10e1c in genheader (f=0x23040) at
../../egcs-19990623/gcc/gengenrtl.c:266
#3  0x10fd8 in main (argc=143424, argv=0xeffffa04)
    at ../../egcs-19990623/gcc/gengenrtl.c:339

So we're dying in gendecl.  From there the we run:
179           fprintf (f, ", %s arg%d", type_from_format (*p), i++);
which segfaults.  I looked at all the variables and they seem fine, so I
tried running type_from_format(*p), which produced a seg fault:

 p type_from_format(*p)

Program received signal SIGSEGV, Segmentation fault.
0x9de3bf90 in ?? ()
The program being debugged stopped while in a function called from GDB.
When the function (type_from_format) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).  When I step into this I get the following, which
seems very strange to me:

(gdb) s
type_from_format (c=101) at ../../egcs-19990623/gcc/gengenrtl.c:62
62        switch (c)
(gdb) p c
$4 = 101
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x9de3bf90 in ?? ()

Any ideas?  Is seems strange that a switch would seg fault.  If it would
help I could give you the core file.

	nathan

PS.  I'm not on the mailing list, if it would make things easier let me
know and I'll join until this has been resolved.

------------
Nathan Field  Root is not something to be shared with strangers.

"One World, One Web, One Program" - Microsoft Promotional Ad
"Ein Volk, Ein Reich, Ein Fuhrer" - Adolf Hitler


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __attribute__((dllimport)) on func defn gives internal error
  1999-07-01  4:19 __attribute__((dllimport)) on func defn gives internal error Olly Betts
@ 1999-07-02 21:49 ` Mumit Khan
  1999-07-31 23:33   ` Olly Betts
  0 siblings, 1 reply; 3+ messages in thread
From: Mumit Khan @ 1999-07-02 21:49 UTC (permalink / raw)
  To: Olly Betts; +Cc: egcs-bugs

Olly Betts <olly@muscat.co.uk> writes:
> If I try to compile this one line C source file:
> 
> __attribute__((dllimport)) int foo(int x) { return 0; }
> 
> with egcs 1.1.2 (built as a linux->mingw cross compiler) I get:
> 
> ../../gcc/toplev.c:3859: Internal compiler error in function rest_of_compilat
> ion
> 

Sigh, it comes back to haunt me. I did fix it locally for C at one point, 
but not for C++ and so never submitted it; I have to look up how to tell 
if it's a method and if it's being defined. Look at i386_pe_mark_dllimport()
in gcc/config/i386/winnt.c to see where it's done for variables for example. 
For C, the following should work:
  
  /* Imported function can't be defined. */
  if (TREE_CODE (decl) == FUNCTION_DECL
      && DECL_INITIAL (decl))
    {
      error_with_decl (decl, "function definition `%s' is marked dllimport");
      return;
    }
  
This is on my todo, but can wait till after 2.95 is released.

Regards,
Mumit


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __attribute__((dllimport)) on func defn gives internal error
  1999-07-02 21:49 ` Mumit Khan
@ 1999-07-31 23:33   ` Olly Betts
  0 siblings, 0 replies; 3+ messages in thread
From: Olly Betts @ 1999-07-31 23:33 UTC (permalink / raw)
  To: Mumit Khan; +Cc: egcs-bugs

In message < 199907030448.XAA08308@mercury.xraylith.wisc.edu >, Mumit Khan writes
:
>Sigh, it comes back to haunt me. I did fix it locally for C at one point, 
>but not for C++ and so never submitted it [...]
>This is on my todo, but can wait till after 2.95 is released.

Sounds entirely reasonable.  I just wanted to make sure someone was aware of
the problem.

Cheers,
Olly


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-07-31 23:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-01  4:19 __attribute__((dllimport)) on func defn gives internal error Olly Betts
1999-07-02 21:49 ` Mumit Khan
1999-07-31 23:33   ` Olly Betts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).