[Bug libquadmath/58327] New: Problem of quadmath in connection with SDL2

2013-09-05 Thread u.weber at gipko dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58327

Bug ID: 58327
   Summary: Problem of quadmath in connection with SDL2
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libquadmath
  Assignee: unassigned at gcc dot gnu.org
  Reporter: u.weber at gipko dot de

"quadmath_snprintf" gives strange results, when SDL2
(http://www.libsdl.org/download-2.0.php) is additionally included. I'm using
"MinGW" with "DevC++" or "Code::Blocks". The short program:

  extern "C" {
  #include "quadmath.h"
  }

  #include "SDL2\SDL.h"
  #include 

  int main(int argc, char* argv[])
  {  char buf[128];
 quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", 46, M_PIq);
 std::cout <<  "PI = " << (float)M_PIq << " / " << buf << std::endl;   
  }

gives the result:

PI = 3.14159 / +3.78539161562520278725e-4917

but when I delete or comment the line  // #include "SDL2\SDL.h" 
I get the expected result:

PI = 3.14159 / +3.14159265358979323846e+00

I guess this is related to Bug 51007 but I don't know how to fix this problem.
I would like to use "quadmath" and "SDL2" together.


[Bug libquadmath/58327] Problem of quadmath in connection with SDL2

2013-09-09 Thread u.weber at gipko dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58327

--- Comment #4 from Ulrich Weber  ---
(In reply to Tobias Burnus from comment #2)
> For what it is worth: It works under x86-64 Linux with GCC 4.9.
> 
> I assume that you do not link SDL2 but you just #include the file - is that
> correct?

I use the linker options -lmingw32 -lquadmath -lSDL2main -lSDL2
if this is the answer to your question. 

When I remove the references to SDL2 here I get a linker error

C:\Program Files (x86)\Dev-Cpp\MinGW32\lib\libmingw32.a(main.o)   
main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'


[Bug libquadmath/58327] Problem of quadmath in connection with SDL2

2013-09-09 Thread u.weber at gipko dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58327

--- Comment #3 from Ulrich Weber  ---
Thank you for the reply. Changing the include order to

#include "SDL2\SDL.h"
#include 

extern "C" {
#include "quadmath.h"
}

gives me the same wrong result.