Project

General

Profile

Bug #12152

libc: cast to pointer from integer of different size

Added by Toomas Soome 3 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Medium
Tags:

Description

Build errors with gcc 9:

    ../i386/crt/_rtld.c: In function '__rtld':
    ../i386/crt/_rtld.c:105:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      105 |    program_name = *((char **)ebp->eb_un.eb_ptr);
          |                     ^
    ../i386/crt/_rtld.c:108:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      108 |    for (ap = (auxv_t *)ebp->eb_un.eb_ptr;
          |              ^
    ../i386/crt/_rtld.c:139:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      139 |  ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC,
          |         ^
    ../i386/crt/_rtld.c:197:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      197 |  maddr = (caddr_t)MMAP(0, mlen, PROT_READ | PROT_EXEC,
          |          ^
    ../i386/crt/_rtld.c:50:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       50 | #define ROUND(x, a)  (((int)(x) + ((int)(a) - 1)) & \
          |                        ^
    ../i386/crt/_rtld.c:201:19: note: in expansion of macro 'ROUND'
      201 |  faddr = (caddr_t)ROUND(maddr, fph->p_align);
          |                   ^~~~~
    ../i386/crt/_rtld.c:201:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      201 |  faddr = (caddr_t)ROUND(maddr, fph->p_align);
          |          ^
    ../i386/crt/_rtld.c:211:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      211 |   maddr = (caddr_t)MMAP(0, mlen, PROT_READ | PROT_EXEC,
          |           ^
    ../i386/crt/_rtld.c:50:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       50 | #define ROUND(x, a)  (((int)(x) + ((int)(a) - 1)) & \
          |                        ^
    ../i386/crt/_rtld.c:215:20: note: in expansion of macro 'ROUND'
      215 |   faddr = (caddr_t)ROUND(maddr, fph->p_align);
          |                    ^~~~~
    ../i386/crt/_rtld.c:215:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      215 |   faddr = (caddr_t)ROUND(maddr, fph->p_align);
          |           ^
    ../i386/crt/_rtld.c:49:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       49 | #define ALIGN(x, a)  ((int)(x) & ~((int)(a) - 1))
          |                       ^
    ../i386/crt/_rtld.c:242:19: note: in expansion of macro 'ALIGN'
      242 |   addr = (caddr_t)ALIGN(faddr + pptr->p_vaddr, page_size);
          |                   ^~~~~
    ../i386/crt/_rtld.c:242:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      242 |   addr = (caddr_t)ALIGN(faddr + pptr->p_vaddr, page_size);
          |          ^
    ../i386/crt/_rtld.c:250:28: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      250 |    (ebp++)->eb_un.eb_ptr = (Elf32_Addr)addr;
          |                            ^
    ../i386/crt/_rtld.c:273:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      273 |   if ((caddr_t)MMAP((caddr_t)addr, flen, i,
          |       ^
    ../i386/crt/_rtld.c:284:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      284 |    foff = (int)faddr + pptr->p_vaddr + pptr->p_filesz;
          |           ^
    ../i386/crt/_rtld.c:285:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      285 |    zaddr = (caddr_t)ROUND(foff, page_size);
          |            ^
    ../i386/crt/_rtld.c:286:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      286 |    for (j = 0; j < (int)(zaddr - foff); j++)
          |                    ^
    ../i386/crt/_rtld.c:287:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      287 |     *((char *)foff + j) = 0;
          |       ^
    ../i386/crt/_rtld.c:295:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      295 |     if ((caddr_t)MMAP((caddr_t)zaddr, j, i,
          |         ^

Also available in: Atom PDF