public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dick_guertin at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/25791] -O2 execution fails, -O and -g work
Date: Tue, 17 Jan 2006 08:33:00 -0000	[thread overview]
Message-ID: <20060117083310.5109.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25791-12018@http.gcc.gnu.org/bugzilla/>



------- Comment #7 from dick_guertin at yahoo dot com  2006-01-17 08:33 -------
Response to: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>

> Program received signal SIGILL, Illegal instruction.
> 0x00297064 in hex_to_character ()
> Could you post an excerpt of the assembly code around 0x00297064?

It really doesn't do any good.  You're assuming hex_to_chararacter is 'entered'
normally.
It is NOT.  The corrupt stack causes a branch into the middle of that routine,
which is why
the system reports an illegal instruction.  Below is a NEXT-by-NEXT trace
leading to the failure.
This was accomplished with a -O2 and -g combination when compiling the source.
Note several 'backups' and 'repeated' statements, ending in the failure.

Starting program: /afs/ir.stanford.edu/users/g/u/guertin/wylsrc/wylbur.ge 

Breakpoint 1, EDTBASE () at comm.c:3613
3613               NSCAN ();
(gdb) next
3614      L_00ECA: I_L(R14,(R11+0x08C));
(gdb) next
3615      L_00ECE: I_SH(R13,(DATA+0x020A));
(gdb) next
3614      L_00ECA: I_L(R14,(R11+0x08C));
(gdb) next
3615      L_00ECE: I_SH(R13,(DATA+0x020A));
(gdb) next
3616      L_00ED2: I_MVC(4,(R14+0x028),(R13));
(gdb) next
3615      L_00ECE: I_SH(R13,(DATA+0x020A));
(gdb) next
3616      L_00ED2: I_MVC(4,(R14+0x028),(R13));
(gdb) next
3615      L_00ECE: I_SH(R13,(DATA+0x020A));
(gdb) next
3616      L_00ED2: I_MVC(4,(R14+0x028),(R13));
(gdb) next
3616      L_00ED2: I_MVC(4,(R14+0x028),(R13));
(gdb) next
3616      L_00ED2: I_MVC(4,(R14+0x028),(R13));
(gdb) next
3616      L_00ED2: I_MVC(4,(R14+0x028),(R13));
(gdb) next
3617      L_00ED8: I_MVC(4,(R14+0x024),(R13+0x04));
(gdb) next
3618      L_00EDE: I_MVC(4,(R14+0x020),(R13+0x08));
(gdb) next
3619      L_00EE4: I_LTR(R15,R15);
(gdb) next
3620      L_00EE6: I_L(R14,(R11+0x08C));
(gdb) next
3619      L_00EE4: I_LTR(R15,R15);
(gdb) next
3620      L_00EE6: I_L(R14,(R11+0x08C));
(gdb) next
3621      L_00EEA: I_L(R1,(R14));
(gdb) next
3622      L_00EEE: I_L(R0,(R14+0x04));
(gdb) next
3623      L_00EF2: I_SR(R14,R14);
(gdb) next
3625               SCINIT ();
(gdb) next
3626      L_00EF6: I_L(R14,(R11+0x08C));
(gdb) next
3627      L_00EFA: I_SH(R13,(DATA+0x020C));
(gdb) next
3626      L_00EF6: I_L(R14,(R11+0x08C));
(gdb) next
3627      L_00EFA: I_SH(R13,(DATA+0x020C));
(gdb) next
3628      L_00EFE: I_MVC(176,(R14),(R13));
(gdb) next
3627      L_00EFA: I_SH(R13,(DATA+0x020C));
(gdb) next
3628      L_00EFE: I_MVC(176,(R14),(R13));
(gdb) next
3627      L_00EFA: I_SH(R13,(DATA+0x020C));
(gdb) next
3628      L_00EFE: I_MVC(176,(R14),(R13));
(gdb) next
3627      L_00EFA: I_SH(R13,(DATA+0x020C));
(gdb) next
3628      L_00EFE: I_MVC(176,(R14),(R13));
(gdb) next
3629      L_00F04: I_L(R14,(R11+0x08C));
(gdb) next
3630      L_00F08: I_XC(176,(R14),(R14));
(gdb) next
3631      L_00F0E: I_SR(R14,R14);
(gdb) next
3632      L_00F10: I_LA(R1,(R11+0x0242));
(gdb) next
3633      L_00F14: I_LH(R0,(R11+0x0240));
(gdb) next
3631      L_00F0E: I_SR(R14,R14);
(gdb) next
3633      L_00F14: I_LH(R0,(R11+0x0240));
(gdb) next
3631      L_00F0E: I_SR(R14,R14);
(gdb) next
3632      L_00F10: I_LA(R1,(R11+0x0242));
(gdb) next
3633      L_00F14: I_LH(R0,(R11+0x0240));
(gdb) next
3634      L_00F18: I_L(R14,(R11+0x08C));
(gdb) next
3635      L_00F1C: I_ST(R1,(R14));
(gdb) next
3636      L_00F20: I_ST(R0,(R14+0x04));
(gdb) next
3637      L_00F24: I_SR(R14,R14);
(gdb) next
3638      L_00F26: I_L(R1,(R11+0x08C));
(gdb) next
3637      L_00F24: I_SR(R14,R14);
(gdb) next
3638      L_00F26: I_L(R1,(R11+0x08C));
(gdb) next
3639      L_00F2A: I_SR(R0,R0);
(gdb) next
3640      L_00F2C: I_L(R14,(R11+0x08C));
(gdb) next
3639      L_00F2A: I_SR(R0,R0);
(gdb) next
3640      L_00F2C: I_L(R14,(R11+0x08C));
(gdb) next
3641      L_00F30: I_MVC(4,(R13),(R14+0x028));
(gdb) next
3642      L_00F36: I_MVC(4,(R13+0x04),(R14+0x024));
(gdb) next
3643      L_00F3C: I_MVC(4,(R13+0x08),(R14+0x020));
(gdb) next
3644      L_00F42: I_LA(R13,(R13+0x0C));
(gdb) next
3645      L_00F46: I_ST(R0,(R1+0x024));
(gdb) next
3646      L_00F4A: I_ST(R0,(R1+0x020));
(gdb) next
3647               R14 = (long int)((char *)( & PRT ));
(gdb) next
3646      L_00F4A: I_ST(R0,(R1+0x020));
(gdb) next
3647               R14 = (long int)((char *)( & PRT ));
(gdb) next
3648      L_00F4E: I_ST(R14,(R1+0x028));
(gdb) next
3650               NSCAN ();
(gdb) next

Program received signal SIGILL, Illegal instruction.
0x00296fec in hex_to_character ()
(gdb) 
=======================
> We need a preprocessed testcase, preferably a runnable testcase but a
> compilable one is sufficient if you can pinpoint the miscompilation.

This program is too big for me to create a testcase.  I have no idea where
execution is going, only the final failure, which doesn't even allow 'gdb'
to know 'where' we are.  The stack is corrupted.  I was able to determine
EDTBASE was the last function in control, but have no idea what clobbers
the stack.  As you can see from the code, it is pseudo-assembler from an
IBM/360 being done in C using macros that create c-equivalent code.  In
order to run on both Big-endian and Little-endian, almost all memory
reference instructions use a complex shift/or process to combine four
bytes into a long.  That's because this code must always be treated as Big
endian, even on Little endian machines.  There's a lot of 'ntohl' or 'htonl'.

I created 'wylsrc.tgz' that you can download and extract.  Since all of this
is Open-Source, you are permitted to have it, especially if -O2 can be fixed.

http://lindy.stanford.edu/~guertin/wylsrc.tgz


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25791


  parent reply	other threads:[~2006-01-17  8:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-15  7:02 [Bug c/25791] New: -O2 execution fails using 3.4.4, " dick_guertin at yahoo dot com
2006-01-15 10:01 ` [Bug c/25791] -O2 execution fails, " ebotcazou at gcc dot gnu dot org
2006-01-16 23:16 ` dick_guertin at yahoo dot com
2006-01-16 23:20 ` [Bug rtl-optimization/25791] " pinskia at gcc dot gnu dot org
2006-01-17  1:19 ` dick_guertin at yahoo dot com
2006-01-17  4:35 ` dick_guertin at yahoo dot com
2006-01-17  6:59 ` ebotcazou at gcc dot gnu dot org
2006-01-17  8:33 ` dick_guertin at yahoo dot com [this message]
2006-01-17  8:47 ` ebotcazou at gcc dot gnu dot org
2006-01-17 19:01 ` dick_guertin at yahoo dot com
2006-01-17 20:55 ` dick_guertin at yahoo dot com
2006-01-18  3:10 ` dick_guertin at yahoo dot com
2006-01-18 13:31 ` ebotcazou at gcc dot gnu dot org
2006-01-18 13:38 ` ebotcazou at gcc dot gnu dot org
2006-01-19  4:00 ` dick_guertin at yahoo dot com
2006-01-19  4:04 ` pinskia at gcc dot gnu dot org
2006-01-19  4:50 ` dick_guertin at yahoo dot com
2006-01-19  6:41 ` dick_guertin at yahoo dot com
2006-01-19  6:51 ` pinskia at gcc dot gnu dot org
2006-01-19  6:55 ` ebotcazou at gcc dot gnu dot org
2006-01-19  7:46 ` dick_guertin at yahoo dot com
2006-01-19  8:26 ` dick_guertin at yahoo dot com
2006-01-19  8:39 ` ebotcazou at gcc dot gnu dot org
2006-01-19 12:16 ` pinskia at gcc dot gnu dot org
2006-01-19 17:54 ` dick_guertin at yahoo dot com
2006-01-19 18:23 ` dick_guertin at yahoo dot com
2006-01-19 18:33 ` ebotcazou at gcc dot gnu dot org
2006-01-21  8:17 ` dick_guertin at yahoo dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060117083310.5109.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).