Re: [[email protected]: Re: Bug#86356: analog: analog segfaults]
[cross-posted to linuxppc-dev]
On 20 Feb, this message from [email protected] echoed through cyberspace:
Quoted 5 lines
Background: analog segfaults when using a custom config file. The author tried debugging the program on my B50 and replied with this message.
Is gcc known to be buggy for powerpc? I'm running 2.95.2-17 and the program has been compiled without optimizations.
No idea whether it _is_ buggy or not. However, the list of arguments to that function below seems rather long to me, so if it is a bug in gcc, it might not have been noticed before.
Anyway, one thing to look at might be the fact that not all function arguments are passed the same way according to the ABI we are using. The first few are passed in registers, the rest on the stack (IIRC). However, I don't know exactly how many are passed in registers. But it would seem that 22 (the arguments coming through OK below) is a bit high a number...
Any of the gcc gurus around?
Michel
Quoted 18 lines
----- Forwarded message from Stephen Turner <[email protected]> -----
OK, I've discovered what's going on, but I have no idea WHY it's going on.
The problem comes at line 736 of
output.c. That line calls printtree, as follows:printtree(outf, rep, outstyle, multibyte, tree, requests, date, badp, badn,
0, NULL, aliashead, linkhead, baseurl, totr, totp, totb, width, possrightalign, bmult, unit, sepchar, repsepchar, decpt, compsep, rawbytes, cols, colhead, colheadp, gender, html, monthname, dayname, monthlen, daylen, plainmonthlen, plaindaylen, lngstr);But by the time we reach printtree, several of the values are wrong. Everything is fine up to unit. But sepchar got repsepchar's true value (0), repsepchar got decpt's true value ('.'), etc., until plaindaylen got lngstr's value (
0x100e93c0= 269390784) and lngstr got a random value.
Quoted 4 lines
As I say, I don't really see how this can have happened. Have you encountered anything like this before?
----- End forwarded message -----
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art. 23, Rue Paul Henkes | Ask Questions. Make Mistakes. L-1710 Luxembourg | email [email protected] | http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Hi,
Most of the bugs in passing parameters have been fixed by the 2.95.3 series Franz Sirl has created.
To see if it is indeed a parameter passing issue, I need to know what the types are for each parameter passed below (specifically if any are long long int or float or double types and what the return type is of that function so that I can tell is any structures are returned.
With that info, I can tell you which registers should have which values on entry to printtree, and what the contents of the overflow stack should look like.
You can then set a breakpoint just inside the printtree frame and do an info registers and an x/30x on the previous frames stack pointer (where the outgoing overflow parameters are actually stored) to check the remaining parameters.
Another (easier solution) is to modify each routine to print the values of all parameters just before the call and just inside the called routine.
That will tell you if gcc miscompiled anything.
Kevin
Quoted 20 lines · Michel Lanners
[cross-posted to linuxppc-dev]
On 20 Feb, this message from [email protected] echoed through cyberspace:
Quoted 5 lines
Background: analog segfaults when using a custom config file. The author tried debugging the program on my B50 and replied with this message.
Is gcc known to be buggy for powerpc? I'm running 2.95.2-17 and the program has been compiled without optimizations.No idea whether it _is_ buggy or not. However, the list of arguments to that function below seems rather long to me, so if it is a bug in gcc, it might not have been noticed before.
Anyway, one thing to look at might be the fact that not all function arguments are passed the same way according to the ABI we are using. The first few are passed in registers, the rest on the stack (IIRC). However, I don't know exactly how many are passed in registers. But it would seem that 22 (the arguments coming through OK below) is a bit high a number...
Quoted 5 lines
Any of the gcc gurus around?
Michel
Quoted 1 line
----- Forwarded message from Stephen Turner
<[email protected]> -----
Quoted 7 lines
Quoted 7 lines
OK, I've discovered what's going on, but I have no idea WHY it's going on.
The problem comes at line 736 of
output.c. That line calls printtree, as follows:printtree(outf, rep, outstyle, multibyte, tree, requests, date, badp,
badn,
Quoted 2 lines
Quoted 2 lines
0, NULL, aliashead, linkhead, baseurl, totr, totp, totb, width, possrightalign, bmult, unit, sepchar, repsepchar, decpt,
compsep,
Quoted 5 lines
Quoted 5 lines
rawbytes, cols, colhead, colheadp, gender, html, monthname, dayname, monthlen, daylen, plainmonthlen, plaindaylen, lngstr);
But by the time we reach printtree, several of the values are wrong. Everything is fine up to unit. But sepchar got repsepchar's true value
(0),
Quoted 9 lines
Quoted 7 lines
repsepchar got decpt's true value ('.'), etc., until plaindaylen got lngstr's value (
0x100e93c0= 269390784) and lngstr got a random value.As I say, I don't really see how this can have happened. Have you encountered anything like this before?
----- End forwarded message -----
Quoted 7 lines
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art. 23, Rue Paul Henkes | Ask Questions. Make Mistakes. L-1710 Luxembourg | email [email protected] | http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
I'm not a gcc guru either, but what is the function prototype for printtree()? The rules for passing parameters vary by what kind of parameters are passed. Also, make SURE you have the CORRECT function prototype for printtree() in the function that calls it. A classic problem is not having a function prototype so the caller sets up the parameters one way but the actual code uses the parameters a different way.
gvb
Quoted 56 lines · Michel Lanners
[cross-posted to linuxppc-dev]
On 20 Feb, this message from [email protected] echoed through cyberspace:
Quoted 5 lines
Background: analog segfaults when using a custom config file. The author tried debugging the program on my B50 and replied with this message.
Is gcc known to be buggy for powerpc? I'm running 2.95.2-17 and the program has been compiled without optimizations.No idea whether it _is_ buggy or not. However, the list of arguments to that function below seems rather long to me, so if it is a bug in gcc, it might not have been noticed before.
Anyway, one thing to look at might be the fact that not all function arguments are passed the same way according to the ABI we are using. The first few are passed in registers, the rest on the stack (IIRC). However, I don't know exactly how many are passed in registers. But it would seem that 22 (the arguments coming through OK below) is a bit high a number...
Any of the gcc gurus around?
Michel
Quoted 1 line
----- Forwarded message from Stephen Turner
<[email protected]> -----
Quoted 2 lines
OK, I've discovered what's going on, but I have no idea WHY it's
going on.
Quoted 2 lines
The problem comes at line 736 of
output.c. That line callsprinttree, as
Quoted 3 lines
follows:
printtree(outf, rep, outstyle, multibyte, tree, requests, date,
badp, badn,
Quoted 1 line
0, NULL, aliashead, linkhead, baseurl, totr, totp, totb,
width,
Quoted 1 line
possrightalign, bmult, unit, sepchar, repsepchar, decpt,
compsep,
Quoted 2 lines
rawbytes, cols, colhead, colheadp, gender, html, monthname, dayname, monthlen, daylen, plainmonthlen, plaindaylen,
lngstr);
Quoted 3 lines
But by the time we reach printtree, several of the values are wrong. Everything is fine up to unit. But sepchar got repsepchar's true
value (0),
Quoted 7 lines
repsepchar got decpt's true value ('.'), etc., until plaindaylen got lngstr's value (
0x100e93c0= 269390784) and lngstr got a random value.As I say, I don't really see how this can have happened. Have you encountered anything like this before?
----- End forwarded message -----
Quoted 7 lines
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art. 23, Rue Paul Henkes | Ask Questions. Make Mistakes. L-1710 Luxembourg | email [email protected] | http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/