Pixie and GCC optimizations

qew
2007-10-31
2013-04-25
  • qew
    qew
    2007-10-31

    Pixie 2.2.2 and SVN built by GCC 4.2.1 with optimizations flags fail on compilation of some shaders and print some garbage on terminal. With -O3 ans -O2 Pixie print " ...: Parse error" on some shaders (I've found this on preview_checker.sl from Sler and displacement from frog_lether Sler example).

    With GCC 4.0.*, GCC 3.* and GCC 4.2.1 with flags -O0 and -O1 everything is OK.

    This is preview_checker.sl

    surface preview_checker()
    {
    if(s < 0.5 && t < 0.5)
         Ci = color(0.5, 0.9, 0.5);
    else if(s < 0.5 && t > 0.5)
        Ci = color(0.9, 0.1, 0.1);
    else if(s > 0.5 && t < 0.5)
        Ci = color(0.9, 0.1, 0.1);
    else if(s > 0.5 && t > 0.5)
        Ci = color(0.5, 0.9, 0.5);
    Oi = 1;
    }

    Or get sler here: http://sourceforge.net/project/showfiles.php?group_id=174811

     
    • qew
      qew
      2007-10-31

      Oh! This is not a Pixie bug report, perhaps this is GCC bug or something else. :) Just for information.

      And may code be modified to workaround these aggressive optimizations?

       
    • qew
      qew
      2007-10-31

      Ah! I don't know what happens :(

      preview_checker.sl and other shaders are compiled but not all situations.

      For example this works for me:

      cd /home/kew/projects/ribkit/tmp/sler/share/ribkit/sler/shaders/
      sdrc preview_checker.sl -o preview_checker.sdr

      but this not:

      cd ~

      sdrc /home/kew/projects/ribkit/tmp/sler/share/ribkit/sler/shaders/preview_checker.sl -o /home/kew/projects/ribkit/tmp/sler/share/ribkit/sler/shaders/preview_checker.sdr

      I get this error:

      �/home/kew/projects/ribkit/tmp/sler/share/ribkit/sler/shaders/preview_checker.sl(1) : error : Parse error

       
      • George Harker
        George Harker
        2007-10-31

        Hi qew,

        This is rather odd.  I don't have a copy of 4.2.1 to check right now, but I'll see what I can do.  Which OS are you on, and is it 64bit?

        I'm sure there are tweaks that can be done.  I wonder if the bison parsing code that bison generates is not working with gcc 4.2.1.  Do you have bison / flex installed?  If so, which versions?

        Also, could you try recompiling sdrc (you can modify the makefile) to change CFLAGS and CXXFLAGS to include -fno-strict-aliasing, that'd help me track it down.

        Cheers

        George

         
    • qew
      qew
      2007-10-31

      Hi George!

      I'm on Gentoo x86, Linux 2.6.22-gentoo-r8, Athlon XP.

      CFLAGS="-O3 -march=athlon-xp -ffast-math -fno-strict-aliasing -fomit-frame-pointer -pipe"
      CXXFLAGS="${CFLAGS}"

      bison-2.3
      flex-2.5.33-r3