* `char * s = "abc";' causes compile to crash with a segfault
@ 2009-04-29 20:53 Alexander Sorockin
2009-04-29 21:08 ` Jeff Garzik
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Sorockin @ 2009-04-29 20:53 UTC (permalink / raw)
To: linux-sparse
I realize that compile is only an example and you are probably familiar
with the problem, but just in case... I was playing around with compile
and here's what got.
------ In Linux (sparse-0.4.1, gcc 4.3.3):
$ ./compile -
char * s = "abc";
-:1:6: warning: symbol 's' was not declared. Should it be static?
.file "-"
=
Segmentation fault
------ In CygWin (sparse-0.4.1, gcc 3.4.4):
$ ./compile -
char * s = "abc";
-:1:6: warning: symbol 's' was not declared. Should it be static?
.file "-"
=
7 [main] compile 1676 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
Segmentation fault (core dumped)
------
Just out of curiosity, is sparse stable enough in general to be used as a
full-fledged front-end for a C compiler?
Best,
Sandy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: `char * s = "abc";' causes compile to crash with a segfault
2009-04-29 20:53 `char * s = "abc";' causes compile to crash with a segfault Alexander Sorockin
@ 2009-04-29 21:08 ` Jeff Garzik
2009-04-29 22:43 ` David Given
2009-04-30 8:55 ` Alexander Sorockin
0 siblings, 2 replies; 7+ messages in thread
From: Jeff Garzik @ 2009-04-29 21:08 UTC (permalink / raw)
To: Alexander Sorockin; +Cc: linux-sparse
Alexander Sorockin wrote:
> I realize that compile is only an example and you are probably familiar
> with the problem, but just in case... I was playing around with compile
> and here's what got.
Yes, that is expected behavior for the program merged as "silly sparse
x86 backend" :) There are many, many, many code generator shortcomings.
> Just out of curiosity, is sparse stable enough in general to be used as
> a full-fledged front-end for a C compiler?
As long as you don't do super-weird, non-standard C: sure.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: `char * s = "abc";' causes compile to crash with a segfault
2009-04-29 21:08 ` Jeff Garzik
@ 2009-04-29 22:43 ` David Given
2009-04-29 23:41 ` Christopher Li
2009-04-30 8:55 ` Alexander Sorockin
1 sibling, 1 reply; 7+ messages in thread
From: David Given @ 2009-04-29 22:43 UTC (permalink / raw)
To: linux-sparse
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jeff Garzik wrote:
[...]
>> Just out of curiosity, is sparse stable enough in general to be used
>> as a full-fledged front-end for a C compiler?
>
> As long as you don't do super-weird, non-standard C: sure.
Well --- I did find a whole bunch of bugs when working on Clue. OTOH
that was a while ago, so some of them might have been fixed by now. Look
back in the archives for 'Odd sparse behaviour' posted on 2008-07-06,
and 'Odd behaviour with OP_SCAST' posted on 2008-09-08.
In addition, I found a number of places where minor tweaks to what data
Sparse keeps around can make a compiler writer's life much easier; for
example, keeping more type data makes finding the type of a pseudo much
easier. There's a combined patch shipped with Clue that fixes and
enhances a bunch of this stuff:
http://cluecc.svn.sourceforge.net/viewvc/cluecc/clue/sparse.patch?revision=34&view=markup
(In fact, if you're generating llvm assembly directly, you may find it
easier just to add a backend to Clue rather than write your own, er,
middle-end --- a lot of the simplifications Clue does for languages like
Javascript also apply to llvm bitcode.)
<plug> Did I mention that Clue is now converting C into Java source that
runs at 40% of compiled C? </plug>
- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "People who think they know everything really annoy those of us who
│ know we don't." --- Bjarne Stroustrup
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJ+Nf6f9E0noFvlzgRAvpIAKCcJG0/SZ0mbx5Iel0iR2GbfJpclACgiQuw
/pkelbkI9I0FkdXqX/bTbQ0=
=581X
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: `char * s = "abc";' causes compile to crash with a segfault
2009-04-29 22:43 ` David Given
@ 2009-04-29 23:41 ` Christopher Li
2009-04-30 10:13 ` David Given
0 siblings, 1 reply; 7+ messages in thread
From: Christopher Li @ 2009-04-29 23:41 UTC (permalink / raw)
To: David Given; +Cc: linux-sparse
On Wed, Apr 29, 2009 at 3:43 PM, David Given <dg@cowlark.com> wrote:
>
> In addition, I found a number of places where minor tweaks to what data
> Sparse keeps around can make a compiler writer's life much easier; for
> example, keeping more type data makes finding the type of a pseudo much
> easier. There's a combined patch shipped with Clue that fixes and
> enhances a bunch of this stuff:
>
> http://cluecc.svn.sourceforge.net/viewvc/cluecc/clue/sparse.patch?revision=34&view=markup
I think some of your patch already went into sparse. If there are some
missing. Feel free to submit it again.
> (In fact, if you're generating llvm assembly directly, you may find it
> easier just to add a backend to Clue rather than write your own, er,
> middle-end --- a lot of the simplifications Clue does for languages like
> Javascript also apply to llvm bitcode.)
If every back end needs to do those "simplifications", that means sparse
should be fixed to do it right.
> <plug> Did I mention that Clue is now converting C into Java source that
> runs at 40% of compiled C? </plug>
Oh really, Java?
Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: `char * s = "abc";' causes compile to crash with a segfault
2009-04-29 21:08 ` Jeff Garzik
2009-04-29 22:43 ` David Given
@ 2009-04-30 8:55 ` Alexander Sorockin
2009-04-30 9:16 ` Christopher Li
1 sibling, 1 reply; 7+ messages in thread
From: Alexander Sorockin @ 2009-04-30 8:55 UTC (permalink / raw)
To: linux-sparse
On Thu, 30 Apr 2009 01:08:59 +0400, Jeff Garzik <jeff@garzik.org> wrote:
>
> As long as you don't do super-weird, non-standard C: sure.
>
Hmm. It's interesting that sparse itself doesn't seem to compile with
anything other that gcc. Does that mean that most other compilers are
"non-standard"?
Sandy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: `char * s = "abc";' causes compile to crash with a segfault
2009-04-30 8:55 ` Alexander Sorockin
@ 2009-04-30 9:16 ` Christopher Li
0 siblings, 0 replies; 7+ messages in thread
From: Christopher Li @ 2009-04-30 9:16 UTC (permalink / raw)
To: Alexander Sorockin; +Cc: linux-sparse
On Thu, Apr 30, 2009 at 1:55 AM, Alexander Sorockin <sorockin@yandex.ru> wrote:
> Hmm. It's interesting that sparse itself doesn't seem to compile with
> anything other that gcc. Does that mean that most other compilers are
> "non-standard"?
Sparse use some C99 feature. Those "non-standard" compiler without C99
support can't compiling it. I don't think sparse has much gcc specific
stuff though.
Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: `char * s = "abc";' causes compile to crash with a segfault
2009-04-29 23:41 ` Christopher Li
@ 2009-04-30 10:13 ` David Given
0 siblings, 0 replies; 7+ messages in thread
From: David Given @ 2009-04-30 10:13 UTC (permalink / raw)
To: linux-sparse
Christopher Li wrote:
[...]
> I think some of your patch already went into sparse. If there are some
> missing. Feel free to submit it again.
The bulk of it's the byte-size patch, which has already made it in, and
the rest is Clue-specific tweaks (like keeping type information in
pseudos, and so on).
[...]
> If every back end needs to do those "simplifications", that means sparse
> should be fixed to do it right.
Actually that stuff's in Clue rather than in the patch --- things like
ultra-simple register allocation, flattening Sparse's parse tree to
Clue's backend model, etc. None of this really makes sense for anything
involving a real compiler (for example, Clue assumes you have an
infinite number of registers available).
In fact, now I think of it, Clue also has a rather intrinsic assumption
that sizeof(int) == sizeof(char) == 1, which means it wouldn't work with
llvm out of the box. It may be productive to rip off some of the code,
though.
--
David Given
dg@cowlark.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-04-30 10:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-29 20:53 `char * s = "abc";' causes compile to crash with a segfault Alexander Sorockin
2009-04-29 21:08 ` Jeff Garzik
2009-04-29 22:43 ` David Given
2009-04-29 23:41 ` Christopher Li
2009-04-30 10:13 ` David Given
2009-04-30 8:55 ` Alexander Sorockin
2009-04-30 9:16 ` Christopher Li
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 NNTP newsgroup(s).