tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Segmentation fault compiling jslong.c


From: Rob Landley
Subject: Re: [Tinycc-devel] Segmentation fault compiling jslong.c
Date: Thu, 27 Sep 2007 19:01:29 -0500
User-agent: KMail/1.9.6

On Tuesday 18 September 2007 11:17:17 am Sanghyeon Seo wrote:
> Hi,
>
> I'm trying to get Spidermonkey built on TCC, which didn't go well.
>
> How to reproduce:
>
> wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.60.tar.gz
> tar zxf js-1.60.tar.gz
> cd js/src
> make -f Makefile.ref CC=tcc

So I finally got the first part of this debugged, and now instead of 
segfaulting it says:

  jslong.c:43: initializer element is not constant

Which is progress.

There are at least three bugs here:

1) If it tried to generate code before the first function, it would 
dereference a cur_text_section that was NULL, and would segfault.

2) When dealing with long long" it looses track of the fact it's dealing 
entirely with constants, and thus tries to generate code, triggering but #1.

3) While testing this, I accidentally tested a file starting with the 
line "long long blah=1LL<32;", I.E. doing a less-than comparison instead of a 
<< shift, and I found ANOTHER bug.

Welcome to tcc development.  I'm working on it. :)

This new bug involves popping more elements off of vtop (the compiler's 
internal argument stack) than were put on it in the first place, and thus 
wandering off the front of the array and doing a vswap() on memory that 
doesn't belong to said stack.  (Which screwed up define_start and thus when 
it tried to free the #define stack at the end of compilation it would 
segfault, and I had to track _back_ to the corruption which just ate about 
six hours.  I now know that the problem is and unbalanced vtop but I haven't 
tracked down where it's getting unbalanced yet.  I know all the pushes and 
pops that happen, I just don't know what it's _supposed_ to be doing.)

Anyway, bug #1 should be fixed, bug #3 I'm working on, and afterwards I can 
tackle bug #2 and _then_ you should be able to compile jslong.c.  :)

(At least as far as the next bug...)

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]