[Bug c/44259] New: pex-unix.c: error: conflicting types for '__char_ptr32'

jay dot krell at cornell dot edu gcc-bugzilla@gcc.gnu.org
Mon May 24 13:01:00 GMT 2010


libiberty/pex-unix.c has some alpha64(ia64?)-dec-vms specific
code, that fails to compile for me due to mismatched typedefs:

+ make
if [ x"" != x ]; then \
          alpha64-dec-vms-gcc -c -DHAVE_CONFIG_H   -I.
-I/src/binutils/src/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat
-Wstrict-prototypes -pedantic   /src/binutils/src/libiberty/pex-unix.c -o
pic/pex-unix.obj; \
        else true; fi
alpha64-dec-vms-gcc -c -DHAVE_CONFIG_H   -I.
-I/src/binutils/src/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat
-Wstrict-prototypes -pedantic  /src/binutils/src/libiberty/pex-unix.c -o
pex-unix.obj
/src/binutils/src/libiberty/pex-unix.c:70:16: error: conflicting types for
'__char_ptr32'
/usr/local/lib/gcc/alpha64-dec-vms/4_5_0/../../../../alpha64-dec-vms/include/decc$types.h:344:20:
note: previous declaration of '__char_ptr32' was here
/src/binutils/src/libiberty/pex-unix.c: In function 'to_ptr32':


Rather than "fix" it, there is a better reliable portable simpler way.
("portable" to alpha[64]-dec-vms at least, gcc and decc, without
dependence either on gcc __attribute__ or decc #pragma pointer_size)


Instead of using __attribute__, use int* when you want an
array of 32bit pointers, and cast, like:


e.g.:


#if defined(VMS) && defined (__LONG_POINTERS)

/* Return a 32 bit pointer to an array of 32 bit pointers 
   given a 64 bit pointer to an array of 64 bit pointers.  */

static char**
to_ptr32 (char **ptr64)
{
  int argc;
  int* short_argv;

  for (argc=0; ptr64[argc]; argc++);

  /* Reallocate argv with 32 bit pointers.  */
  short_argv = (int*) decc$_malloc32(sizeof (int) * (argc + 1));

  for (argc=0; ptr64[argc]; argc++)
    short_argv[argc] = (int) decc$_strdup32 (ptr64[argc]);

  short_argv[argc] = 0;
  return (char**) short_argv;
}


-- 
           Summary: pex-unix.c: error: conflicting types for '__char_ptr32'
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jay dot krell at cornell dot edu
GCC target triplet: alpha64-dec-vms


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



More information about the Gcc-bugs mailing list