public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: John Cotton Ericson <Ericson2314@yahoo.com>
To: gcc-help@gcc.gnu.org
Subject: GCC vs MSVC compiler issues in a port
Date: Sat, 22 Dec 2012 09:07:00 -0000	[thread overview]
Message-ID: <50D57838.10903@yahoo.com> (raw)
In-Reply-To: <50D57597.7050304@yahoo.com>

Hello,

For a little over a year I have worked on porting the a voxel engine 
called Voxlap to work on Linux. My code is here: 
https://github.com/Ericson2314/Voxlap

I now can compile the same code with both MSVC and gcc. The MSVC code 
runs well enough, but the gcc version does not. Specifically when I run 
the MSVC version, everything in-game renders, and a bit of text is 
thrown on top as a watermark. When I run  the gcc version, all I get is 
a black window and that water mark. The problem is exactly whether I 
compile on windows with mingw or compile on linux. In both cases I am 
compiling the same branch with most of the inline assembly converted to 
C, and in both cases I compile against the SDL backend, not the direct X 
backend.

Because I have done my best to hold everything else constant, I am 
pretty convinced this error is either due to some subtle difference's in 
the two compile's understanding of the C semantics, or an error in the 
gcc version of what inline assembly remains (inline assembly being the 
only code I can think of which is #ifdefed based on the compiler).

After a couple of months of sporadically trying to solve this issue, I 
am at a loss what to do next. As I did not write the original renderer, 
and thus I am only so familiar with it's inner workings. I was hoping 
somebody more experience with porting or more knowledge of subtle 
differences between gcc and MSVC would be able to help me solve this 
issue, which should be the last before I have a basic gcc version ready.

Thanks,
John

Notes:

Here is a list of the only "leads" I can think of:

* If I do not use -ffast-math, the gcc version crashes almost 
immediately due to an arithmetic overflow. I do not think the MSVC 
version with any flags I tried ever had this problem

* I think I onced compared the symbol tables of the same object file 
compiled with each compiler and found some differences. However, I have 
no idea what differences there are acceptable (besides different 
name-mangling schemes)  and what ones are not.

* What inline assembly assembly remains is #ifdef-d based on the 
compiler. This is the only code I can think of that is compiler-specific.

While the code is saved as a C++ file it contains almost no c++-specific 
syntax. A couple of people have asked me about this from time to time, 
so I'd include the answer as an addendum.

I wrote a pretty decent (I hope?) history of the port which may be found 
in the readme. It may be of use.

       reply	other threads:[~2012-12-22  9:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50D57597.7050304@yahoo.com>
2012-12-22  9:07 ` John Cotton Ericson [this message]
2012-12-22 12:11   ` Oleg Endo
2012-12-23  5:39     ` John Cotton Ericson
2012-12-27 13:10       ` David Brown
2012-12-28 23:46       ` Oleg Endo
2013-01-18 22:31         ` John Cotton Ericson
2012-12-22 16:31   ` Andrew Haley

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=50D57838.10903@yahoo.com \
    --to=ericson2314@yahoo.com \
    --cc=gcc-help@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).