gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

.
.
unsigned long lay_sav
.
.
#ifdef  GCC_NEED
      /* this is what gcc handles correctly: f_bar[] is expanded into a larger 
       * array proj_res_corr[]
       */
      pred_expand( n1_sml, n2_sml, f_bar,
                   n1_lrg, n2_lrg, &proj_res_corr[ lay_sav]);   /* pointer-
                                                                 * convntn */
#else   GCC_NEED
      /* GNU compiler goes wrong on this one - looks like lay_sav
       * screws something up -> needs lay_sav to be "long" NOT "unsigned long"
       * interestingly the computed result inside the proj_res_corr[] is wrong
       * for a given f_bar[]. Actually fbar is simply copied into
       * proj_res_corr[] as if n1_lrg and n1_sml etc. are the same.
       */
      pred_expand( n1_sml, n2_sml, f_bar,
                   n1_lrg, n2_lrg, proj_res_corr + lay_sav);    /* pointer-
                                                                 * convntn */
#endif  GCC_NEED
.
.
.
      /* GNU compiler goes STILL RIGHT on this one
 */
      write_image( proj_res_corr + lay_sav,
                   (I_8)sizeof( *proj_res_corr),
                   (I_8)NO, (I_8)NO, "PROJ_exp_res_corr..bmp");

the compile otpion is "gcc -O -fpic -m64 -lm -lc"

I have the impression that this should not happen in dependency on the type of
lay_sav. It looks like lay_sav is ignored and the variables n1_lrg etc. are
changed. Possibly there should be a warning.


-- 
           Summary: adress passing with unsigned long pointer increments
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wolfram at cyber-inc dot us


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

Reply via email to