Re: [Tinycc-devel] [PATCH] tcc: remove buggy nodata_wanted optimization

2018-03-12 Thread Mikulas Patocka


On Fri, 23 Feb 2018, Michael Matz wrote:

> Hi,
> 
> On Thu, 22 Feb 2018, Mikulas Patocka wrote:
> 
> > I think that that nodata_wanted misoptimization should be removed at all 
> > - in the C language, you can jump to any location in the function with 
> > goto or switch-case statement - thus reasoning such as "all the 
> > variables behind if (0) are unreachable" is incorrect.
> > 
> > If you wanted to do that optimization correctly, you'd need to build 
> > control flow graph, and tcc is just too simple to do that.
> 
> You're right that as implemented the non-allocation of variables is wrong.  
> But a full CFG isn't needed to fix this, the allocation merely needs to be 
> postponed to the first real use.  Unfortunately that is somewhat 
> complicated when there are initializers (which matter only for static vars 
> in this case, but still).
> 
> So, yeah, the easy fix is to remove it, but with more work the 
> optimization (or parts of it) could be retained, grischka?
> 
> 
> Ciao,
> Michael.

I think tcc is too simple to do such optimizations as holding variables 
and allocating them when they are used. If I need an optimizing compiler, 
I use gcc, if I need something fast and simple, I use tcc.

Mikulas

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Documentation Suggestion

2018-03-12 Thread arnold
Patrick  wrote:

> I just re-tested ncurses and it compiles fine with and without 
> --disable-shared.
>
> However I tried to compile GnuCOBOL and libao and both will fail without 
> --disabled-shared and compile with this flag.

I'll let the developers answer; I don't use TinyCC for anything
but compiling gawk during development.

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Documentation Suggestion

2018-03-12 Thread Patrick

On 18-03-12 09:39 AM, Patrick wrote:

On 18-03-12 09:27 AM, arn...@skeeve.com wrote:

Patrick  wrote:


Last night I tried again but this time I did not alter my bashrc but
instead used ./configure disable-shared CC=tcc

I guess TCC can't generate position independent code. I am having a lot
more luck now and I had a great time last night compiling several 
projects.

I use it on x86_64 Linux to generate shared objects all the time
(the extensions in gawk).  Is this on Linux or some other OS?

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Hi Arnold

I am on Linux 64 bit.

I realize that it can create shared code but could there be an issue 
with PIC ?


When I go to compile the projects of others, I am having trouble 
without the --disable-shared flag but not without it.


Could it be that other projects(ncurses for example) that use PIC by 
default but not when this flag is used?


Thanks for responding to my post-Pat

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Hi again Arnold

I gave some false information.

I just re-tested ncurses and it compiles fine with and without 
--disable-shared.


However I tried to compile GnuCOBOL and libao and both will fail without 
--disabled-shared and compile with this flag.


Thanks


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Documentation Suggestion

2018-03-12 Thread Patrick

On 18-03-12 09:27 AM, arn...@skeeve.com wrote:

Patrick  wrote:


Last night I tried again but this time I did not alter my bashrc but
instead used ./configure disable-shared CC=tcc

I guess TCC can't generate position independent code. I am having a lot
more luck now and I had a great time last night compiling several projects.

I use it on x86_64 Linux to generate shared objects all the time
(the extensions in gawk).  Is this on Linux or some other OS?

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Hi Arnold

I am on Linux 64 bit.

I realize that it can create shared code but could there be an issue 
with PIC ?


When I go to compile the projects of others, I am having trouble without 
the --disable-shared flag but not without it.


Could it be that other projects(ncurses for example) that use PIC by 
default but not when this flag is used?


Thanks for responding to my post-Pat

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Documentation Suggestion

2018-03-12 Thread arnold
Patrick  wrote:

> Last night I tried again but this time I did not alter my bashrc but 
> instead used ./configure disable-shared CC=tcc
>
> I guess TCC can't generate position independent code. I am having a lot 
> more luck now and I had a great time last night compiling several projects.

I use it on x86_64 Linux to generate shared objects all the time
(the extensions in gawk).  Is this on Linux or some other OS?

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Documentation Suggestion

2018-03-12 Thread Patrick

Hi Everyone

I tried TCC a few years ago. If I remember correctly I used something 
like CC=tcc in my bashrc.


I wasn't able to compile anything but toy programs with it and I moved on.

Last night I tried again but this time I did not alter my bashrc but 
instead used ./configure disable-shared CC=tcc


I guess TCC can't generate position independent code. I am having a lot 
more luck now and I had a great time last night compiling several projects.


If you think that others will benefit from this approach, perhaps it 
would be good to have in the documentation. I missed a few years of 
happiness with TCC !


-Pat



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel