public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Paul Coward" <paul@asgard.net.au>
To: cygwin@sourceware.cygnus.com
Subject: Stack problem in Beta 20.1 ???
Date: Wed, 31 Mar 1999 19:45:00 -0000	[thread overview]
Message-ID: <13115.947490286.0@NO-ID-FOUND.mhonarc.org> (raw)

Hi,

The following code fragment fails to compile correctly under 20.1 unless 
the setjmp/longjmp pair are included to fix an apparant stack problem.

This code is run inside a loop and prints the correct values the first time 
through but totally stuffs up on subsequent passes (unless the 
setjmp/longjmp are present).

As near as I can tell the code seems to get the stack alignment wrong 
after the first pass.  The fact the the setjmp/longjmp pair seem to have 
fixed the problem seems to support this assumption.

This is the first time that I have compiled a program with cygwin that 
passes so many args on the stack (9 in the case of 
PRN_SetPrintText()).  Could this be the cause of the problem?

The values passed don't matter.  Even the fprintf call stuffs up with too 
many parameters passed.

      if (setjmp(jmpBuf) == 0) {
#ifdef DEBUG_PRN
       fprintf(stderr, " Push constants\n");
       fprintf(stderr, "   (left) %ld\n   (top) %ld\n   (charType) %d\n   
(charWidth) 
%d\n   (charHeight) %d\n   (charRot) %d\n   (stringRot) %d\n   
(charSpace) %d)\n",
                ((long) (((double) text->tfLeft) / TWIPS_PER_THERM)),
                ((long) (((double) text->tfTop) / TWIPS_PER_THERM)),
                1, 1, 1, 0, 0, 3);

       fprintf(stderr, " Push normal\n");
       fprintf(stderr, "   (left) %ld\n   (top) %ld\n   (charType) %ld\n   
(charWidth) 
%ld\n   (charHeight) %ld\n   (charRot) %ld\n   (stringRot) %ld\n   
(charSpace) 
%ld)\n",
                ((long) (((double) text->tfLeft) / TWIPS_PER_THERM)),
                ((long) (((double) text->tfTop) / TWIPS_PER_THERM)),
                charType, charWidth, charHeight, charRot, stringRot, 
charSpace);
       fprintf(stderr, "PRN_SetPrintText(\"%s\"\n\t(left) %d\n\t(top) 
%d\n\t(charType) 
%d\n\t(charWidth) %d\n\t(charHeight) %d\n\t(charRot) %d\n\t(stringRot) 
%d\n\t(charSpace) %d)\n",
                text->tfText,
                ((long) (((double) text->tfLeft) / TWIPS_PER_THERM)),
                ((long) (((double) text->tfTop) / TWIPS_PER_THERM)),
                charType, charWidth, charHeight, charRot, stringRot, 
charSpace);
#endif
       result = PRN_SetPrintText(text->tfText,
               ((long) (((double) text->tfLeft) / TWIPS_PER_THERM)),
               ((long) (((double) text->tfTop) / TWIPS_PER_THERM)),
               charType,
               charWidth,
               charHeight,
               charRot,
               stringRot,
               charSpace);
       if (result != PRN_SUCCESS) {
        LogError("Failed SetPrintText() call for \"%s\" (return code 
0x%08x)", 
text->tfText, result);
        Shutdown(1);
       }
       longjmp(jmpBuf, 1);
      }


Of course, it could be my fault.  I've spent 2 days trying to find a 
problem in my code.  It wasn't until I started to suspect the compiler 
and included setjmp that the problem disappeared.

If this is found to be a bug in cygwin could someone please mail me 
direct as I don't subscribe to this list.

Thanks
Paul Coward.



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


             reply	other threads:[~1999-03-31 19:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-31 19:45 Paul Coward [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-03-06  8:23 Paul Coward

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=13115.947490286.0@NO-ID-FOUND.mhonarc.org \
    --to=paul@asgard.net.au \
    --cc=cygwin@sourceware.cygnus.com \
    /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).