mailing list of musl libc
 help / color / mirror / code / Atom feed
* pcc i386 -fPIC compiler error on src/complex/catanf.c
@ 2015-01-04  5:53 Isaac Dunham
  2015-01-04 17:47 ` Iain Hibbert
  0 siblings, 1 reply; 10+ messages in thread
From: Isaac Dunham @ 2015-01-04  5:53 UTC (permalink / raw)
  To: musl, pcc

Hello,
With recent pcc (built from cvs since 1.1.0 was released), I've tried
building musl a few times, but the shared build consistently dies
on src/complex/catanf.c (command wrapped to avoid getting mangled
in the mail):
$ make
pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard    \
  -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal \
  -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables     \
  -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486      \
  -Werror=implicit-function-declaration -Werror=implicit-int 	     \
  -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector    \
  -fPIC -DSHARED -c -o src/complex/catanf.lo src/complex/catanf.c
src/complex/catanf.c, line 80: compiler error: bad STCALL hidden reg
error: /usr/libexec/ccom terminated with status 1
Makefile:124: recipe for target 'src/complex/catanf.lo' failed
make: *** [src/complex/catanf.lo] Error 1

Line 80 is the closing bracket of _redupif(), which is fairly basic
floating point math.

If I try removing flags from the command until it compiles, -fPIC seems
to be what triggers the compiler error.

I'm compiling pcc with these flags:
$ ./configure --prefix=/usr --build=i486-alpine-linux-musl --target=i486-alpine-linux-musl --enable-tls --with-libdir=/usr/lib --with-incdir=/usr/include

With tls disabled (as per default), it still fails the same.

I can't really isolate the error in question, I'm afraid.

Thanks,
Isaac Dunham


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

* Re: pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04  5:53 pcc i386 -fPIC compiler error on src/complex/catanf.c Isaac Dunham
@ 2015-01-04 17:47 ` Iain Hibbert
  2015-01-04 18:01   ` Re: [Pcc] " Rich Felker
  2015-01-04 19:24   ` Anders Magnusson
  0 siblings, 2 replies; 10+ messages in thread
From: Iain Hibbert @ 2015-01-04 17:47 UTC (permalink / raw)
  To: Isaac Dunham; +Cc: musl, pcc

On Sat, 3 Jan 2015, Isaac Dunham wrote:

> Hello,
> With recent pcc (built from cvs since 1.1.0 was released), I've tried
> building musl a few times, but the shared build consistently dies
> on src/complex/catanf.c (command wrapped to avoid getting mangled
> in the mail):
> $ make
> pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard    \
>   -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal \
>   -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables     \
>   -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486      \
>   -Werror=implicit-function-declaration -Werror=implicit-int 	     \
>   -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector    \
>   -fPIC -DSHARED -c -o src/complex/catanf.lo src/complex/catanf.c
> src/complex/catanf.c, line 80: compiler error: bad STCALL hidden reg
> error: /usr/libexec/ccom terminated with status 1
> Makefile:124: recipe for target 'src/complex/catanf.lo' failed
> make: *** [src/complex/catanf.lo] Error 1
>
> Line 80 is the closing bracket of _redupif(), which is fairly basic
> floating point math.

it will likely be something inside that function that does not show up
until the function is being emitted. STCALL is something to do with
structure arguments, which some kinds of floating point are big enough to
be considered.. so I guess some kind of double or long double arguments?

> I can't really isolate the error in question, I'm afraid.

maybe if you post the function, somebody else would be able to?

iain
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc


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

* Re: Re: [Pcc] pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04 17:47 ` Iain Hibbert
@ 2015-01-04 18:01   ` Rich Felker
  2015-01-04 19:26     ` Jens Gustedt
  2015-01-04 19:24   ` Anders Magnusson
  1 sibling, 1 reply; 10+ messages in thread
From: Rich Felker @ 2015-01-04 18:01 UTC (permalink / raw)
  To: Iain Hibbert; +Cc: Isaac Dunham, musl, pcc

On Sun, Jan 04, 2015 at 05:47:24PM +0000, Iain Hibbert wrote:
> On Sat, 3 Jan 2015, Isaac Dunham wrote:
> 
> > Hello,
> > With recent pcc (built from cvs since 1.1.0 was released), I've tried
> > building musl a few times, but the shared build consistently dies
> > on src/complex/catanf.c (command wrapped to avoid getting mangled
> > in the mail):
> > $ make
> > pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard    \
> >   -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal \
> >   -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables     \
> >   -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486      \
> >   -Werror=implicit-function-declaration -Werror=implicit-int 	     \
> >   -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector    \
> >   -fPIC -DSHARED -c -o src/complex/catanf.lo src/complex/catanf.c
> > src/complex/catanf.c, line 80: compiler error: bad STCALL hidden reg
> > error: /usr/libexec/ccom terminated with status 1
> > Makefile:124: recipe for target 'src/complex/catanf.lo' failed
> > make: *** [src/complex/catanf.lo] Error 1
> >
> > Line 80 is the closing bracket of _redupif(), which is fairly basic
> > floating point math.
> 
> it will likely be something inside that function that does not show up
> until the function is being emitted. STCALL is something to do with
> structure arguments, which some kinds of floating point are big enough to
> be considered.. so I guess some kind of double or long double arguments?

I would guess it's treating complex floating point objects like
structures. However...

> > I can't really isolate the error in question, I'm afraid.
> 
> maybe if you post the function, somebody else would be able to?

...the function where the error is reported is not using any complex
objects:

http://git.musl-libc.org/cgit/musl/tree/src/complex/catanf.c?id=v1.1.5

So something else must be going on.

Rich


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

* Re: pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04 17:47 ` Iain Hibbert
  2015-01-04 18:01   ` Re: [Pcc] " Rich Felker
@ 2015-01-04 19:24   ` Anders Magnusson
  2015-01-04 21:04     ` Isaac Dunham
  1 sibling, 1 reply; 10+ messages in thread
From: Anders Magnusson @ 2015-01-04 19:24 UTC (permalink / raw)
  To: Iain Hibbert, Isaac Dunham; +Cc: musl, pcc

Iain Hibbert skrev den 2015-01-04 18:47:
> On Sat, 3 Jan 2015, Isaac Dunham wrote:
>
>> Hello,
>> With recent pcc (built from cvs since 1.1.0 was released), I've tried
>> building musl a few times, but the shared build consistently dies
>> on src/complex/catanf.c (command wrapped to avoid getting mangled
>> in the mail):
>> $ make
>> pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard    \
>>    -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal \
>>    -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables     \
>>    -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486      \
>>    -Werror=implicit-function-declaration -Werror=implicit-int 	     \
>>    -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector    \
>>    -fPIC -DSHARED -c -o src/complex/catanf.lo src/complex/catanf.c
>> src/complex/catanf.c, line 80: compiler error: bad STCALL hidden reg
>> error: /usr/libexec/ccom terminated with status 1
>> Makefile:124: recipe for target 'src/complex/catanf.lo' failed
>> make: *** [src/complex/catanf.lo] Error 1
>>
>> Line 80 is the closing bracket of _redupif(), which is fairly basic
>> floating point math.
> it will likely be something inside that function that does not show up
> until the function is being emitted. STCALL is something to do with
> structure arguments, which some kinds of floating point are big enough to
> be considered.. so I guess some kind of double or long double arguments?
>
This assertion occurs because pass2 code expects a hidden argument to be
present when calling a struct return function, but the hidden arg cannot be
found in the argument list, and in this special case the hidden arg shall be
in a register.

I would like a preprocessed output from the above to diagnose further (which
means to just add a -E to the line above).

-- Ragge
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc


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

* Re: Re: [Pcc] pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04 18:01   ` Re: [Pcc] " Rich Felker
@ 2015-01-04 19:26     ` Jens Gustedt
  0 siblings, 0 replies; 10+ messages in thread
From: Jens Gustedt @ 2015-01-04 19:26 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]

Am Sonntag, den 04.01.2015, 13:01 -0500 schrieb Rich Felker:
> On Sun, Jan 04, 2015 at 05:47:24PM +0000, Iain Hibbert wrote:
> > it will likely be something inside that function that does not show up
> > until the function is being emitted. STCALL is something to do with
> > structure arguments, which some kinds of floating point are big enough to
> > be considered.. so I guess some kind of double or long double arguments?
> 
> I would guess it's treating complex floating point objects like
> structures. However...
> 
> > > I can't really isolate the error in question, I'm afraid.
> > 
> > maybe if you post the function, somebody else would be able to?
> 
> ...the function where the error is reported is not using any complex
> objects:
> 
> http://git.musl-libc.org/cgit/musl/tree/src/complex/catanf.c?id=v1.1.5

You are refering to _redupif?

This is a `static` function that is used exactly once. Perhaps the
compiler "augments" it to `float complex` return type, because the
context where it is used is of that type. It would be interesting to
see if the error disappears if the return value is first stored in a
`volatile float`, and only then assigned to `w`.

Jens

-- 
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04 19:24   ` Anders Magnusson
@ 2015-01-04 21:04     ` Isaac Dunham
  2015-01-04 21:54       ` Isaac Dunham
  2015-01-05 10:31       ` Anders Magnusson
  0 siblings, 2 replies; 10+ messages in thread
From: Isaac Dunham @ 2015-01-04 21:04 UTC (permalink / raw)
  To: Anders Magnusson; +Cc: musl, pcc

[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]

On Sun, Jan 04, 2015 at 08:24:54PM +0100, Anders Magnusson wrote:
> Iain Hibbert skrev den 2015-01-04 18:47:
> >On Sat, 3 Jan 2015, Isaac Dunham wrote:
> >
> >>Hello,
> >>With recent pcc (built from cvs since 1.1.0 was released), I've tried
> >>building musl a few times, but the shared build consistently dies
> >>on src/complex/catanf.c (command wrapped to avoid getting mangled
> >>in the mail):
> >>$ make
> >>pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard    \
> >>   -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal \
> >>   -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables     \
> >>   -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486      \
> >>   -Werror=implicit-function-declaration -Werror=implicit-int 	     \
> >>   -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector    \
> >>   -fPIC -DSHARED -c -o src/complex/catanf.lo src/complex/catanf.c
> >>src/complex/catanf.c, line 80: compiler error: bad STCALL hidden reg
> >>error: /usr/libexec/ccom terminated with status 1
> >>Makefile:124: recipe for target 'src/complex/catanf.lo' failed
> >>make: *** [src/complex/catanf.lo] Error 1
> >>
> >>Line 80 is the closing bracket of _redupif(), which is fairly basic
> >>floating point math.
> >it will likely be something inside that function that does not show up
> >until the function is being emitted. STCALL is something to do with
> >structure arguments, which some kinds of floating point are big enough to
> >be considered.. so I guess some kind of double or long double arguments?
> >
> This assertion occurs because pass2 code expects a hidden argument to be
> present when calling a struct return function, but the hidden arg cannot be
> found in the argument list, and in this special case the hidden arg shall be
> in a register.
> 
> I would like a preprocessed output from the above to diagnose further (which
> means to just add a -E to the line above).

Ok, will send.

Thanks!
Isaac Dunham

[-- Attachment #2: catanf.i.gz --]
[-- Type: application/octet-stream, Size: 2638 bytes --]

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc

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

* Re: pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04 21:04     ` Isaac Dunham
@ 2015-01-04 21:54       ` Isaac Dunham
  2015-01-05 10:31       ` Anders Magnusson
  1 sibling, 0 replies; 10+ messages in thread
From: Isaac Dunham @ 2015-01-04 21:54 UTC (permalink / raw)
  To: Anders Magnusson; +Cc: musl, pcc

[-- Attachment #1: Type: text/plain, Size: 705 bytes --]

Sorry for the noise, but the catanf.i.gz above was from a slightly modified
catanf.c (which had the same behavior as the original code).
I had changed this from upstream musl:
===
--- a/src/complex/catanf.c
+++ b/src/complex/catanf.c
@@ -61,12 +61,12 @@ static const double DP1 = 3.140625;
 static const double DP2 = 9.67502593994140625E-4;
 static const double DP3 = 1.509957990978376432E-7;
 
-static float _redupif(float xx)
+static float _redupif(float x)
 {
-	float x, t;
+	float t;
 	long i;
 
-	x = xx;
+	//x = xx;
 	t = x/(float)M_PI;
 	if (t >= 0.0f)
 		t += 0.5f;
===

The preprocessed code has a corresponding change; I'm attaching the gzip'd
result of the original code.

Thanks,
Isaac Dunham

[-- Attachment #2: catanf.i.gz --]
[-- Type: application/octet-stream, Size: 2637 bytes --]

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc

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

* Re: pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-04 21:04     ` Isaac Dunham
  2015-01-04 21:54       ` Isaac Dunham
@ 2015-01-05 10:31       ` Anders Magnusson
  2015-01-05 23:25         ` [Pcc] " Isaac Dunham
  1 sibling, 1 reply; 10+ messages in thread
From: Anders Magnusson @ 2015-01-05 10:31 UTC (permalink / raw)
  To: Isaac Dunham; +Cc: musl, pcc

Isaac Dunham skrev den 2015-01-04 22:04:
> On Sun, Jan 04, 2015 at 08:24:54PM +0100, Anders Magnusson wrote:
>> Iain Hibbert skrev den 2015-01-04 18:47:
>>> On Sat, 3 Jan 2015, Isaac Dunham wrote:
>>>
>>>> Hello,
>>>> With recent pcc (built from cvs since 1.1.0 was released), I've tried
>>>> building musl a few times, but the shared build consistently dies
>>>> on src/complex/catanf.c (command wrapped to avoid getting mangled
>>>> in the mail):
>>>> $ make
>>>> pcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard    \
>>>>    -frounding-math -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal \
>>>>    -I./include  -Os -pipe -fomit-frame-pointer -fno-unwind-tables     \
>>>>    -fno-asynchronous-unwind-tables -Wa,--noexecstack -march=i486      \
>>>>    -Werror=implicit-function-declaration -Werror=implicit-int 	     \
>>>>    -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector    \
>>>>    -fPIC -DSHARED -c -o src/complex/catanf.lo src/complex/catanf.c
>>>> src/complex/catanf.c, line 80: compiler error: bad STCALL hidden reg
>>>> error: /usr/libexec/ccom terminated with status 1
>>>> Makefile:124: recipe for target 'src/complex/catanf.lo' failed
>>>> make: *** [src/complex/catanf.lo] Error 1
>>>>
>>>> Line 80 is the closing bracket of _redupif(), which is fairly basic
>>>> floating point math.
>>> it will likely be something inside that function that does not show up
>>> until the function is being emitted. STCALL is something to do with
>>> structure arguments, which some kinds of floating point are big enough to
>>> be considered.. so I guess some kind of double or long double arguments?
>>>
>> This assertion occurs because pass2 code expects a hidden argument to be
>> present when calling a struct return function, but the hidden arg cannot be
>> found in the argument list, and in this special case the hidden arg shall be
>> in a register.
>>
>> I would like a preprocessed output from the above to diagnose further (which
>> means to just add a -E to the line above).
> Ok, will send.
>
Thanks, fixed now.
Float complex struct return were not dealt with as it should in the PIC 
case.

-- Ragge
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc


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

* Re: [Pcc] pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-05 10:31       ` Anders Magnusson
@ 2015-01-05 23:25         ` Isaac Dunham
  2015-01-06  3:27           ` Anders Magnusson
  0 siblings, 1 reply; 10+ messages in thread
From: Isaac Dunham @ 2015-01-05 23:25 UTC (permalink / raw)
  To: Anders Magnusson; +Cc: musl, pcc

On Mon, Jan 05, 2015 at 11:31:11AM +0100, Anders Magnusson wrote:
> Thanks, fixed now.
> Float complex struct return were not dealt with as it should in the PIC
> case.
> 

Thank you, but I'm afraid that now I'm getting another error for most code
when I compile with -fPIC:
$ pcc -fPIC argvname.c -o argvname
/tmp/ctm.HhEooN: Assembler messages:
/tmp/ctm.HhEooN:1: Error: no such instruction: `pucext'
/tmp/ctm.HhEooN:2: Error: junk at end of line, first unrecognized character is `0'
/tmp/ctm.HhEooN:3: Error: junk at end of line, first unrecognized character is `0'
/tmp/ctm.HhEooN:4: Error: junk at end of line, first unrecognized character is `0'
/tmp/ctm.HhEooN:5: Error: junk at end of line, first unrecognized character is `0'
/tmp/ctm.HhEooN:6: Error: junk at end of line, first unrecognized character is `0'
/tmp/ctm.HhEooN:7: Error: junk at end of line, first unrecognized character is `0'
/tmp/ctm.HhEooN:8: Error: junk at end of line, first unrecognized character is `0'
error: as terminated with status 1


argvname.c is a trivial example, as follows:
#include <stdio.h>

int main(int argc, char *argv[])
{
	puts(argv[0]);
}
EOF

I'm getting the impression that this was debugging code dumping some of
the compiler state (at line 174, arch/i386/local.c).
Is that correct?

Thanks,
Isaac Dunham


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

* Re: [Pcc] pcc i386 -fPIC compiler error on src/complex/catanf.c
  2015-01-05 23:25         ` [Pcc] " Isaac Dunham
@ 2015-01-06  3:27           ` Anders Magnusson
  0 siblings, 0 replies; 10+ messages in thread
From: Anders Magnusson @ 2015-01-06  3:27 UTC (permalink / raw)
  To: Isaac Dunham; +Cc: musl, pcc

Isaac Dunham skrev den 2015-01-06 00:25:
> On Mon, Jan 05, 2015 at 11:31:11AM +0100, Anders Magnusson wrote:
>> Thanks, fixed now.
>> Float complex struct return were not dealt with as it should in the PIC
>> case.
>>
> Thank you, but I'm afraid that now I'm getting another error for most code
> when I compile with -fPIC:
> $ pcc -fPIC argvname.c -o argvname
> /tmp/ctm.HhEooN: Assembler messages:
>
I did check in a debug printout by mistake :-/  Fixed now, thanks.

-- R


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

end of thread, other threads:[~2015-01-06  3:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-04  5:53 pcc i386 -fPIC compiler error on src/complex/catanf.c Isaac Dunham
2015-01-04 17:47 ` Iain Hibbert
2015-01-04 18:01   ` Re: [Pcc] " Rich Felker
2015-01-04 19:26     ` Jens Gustedt
2015-01-04 19:24   ` Anders Magnusson
2015-01-04 21:04     ` Isaac Dunham
2015-01-04 21:54       ` Isaac Dunham
2015-01-05 10:31       ` Anders Magnusson
2015-01-05 23:25         ` [Pcc] " Isaac Dunham
2015-01-06  3:27           ` Anders Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).