Ticket #1428 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

pbc_merge breaks c++ build

Reported by: NotFound Owned by: dukeleto
Priority: blocker Milestone:
Component: tools Version: 2.0.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

At r43774 a C++ build fails:

src/pbc_merge.c: In function ‘void pbc_merge_ctpointers(parrot_interp_t*, pbc_merge_input**, int, PackFile_ByteCode*)’:
src/pbc_merge.c:664: warning: overflow in implicit constant conversion
src/pbc_merge.c:664: error: duplicate case value
src/pbc_merge.c:663: error: previously used here
make: *** [src/pbc_merge.o] Error 1

The problematic cases are PARROT_ARG_SC and PARROT_ARG_NAME_SC, which are:

PARROT_ARG_SC = PARROT_ARG_STRING   | PARROT_ARG_CONSTANT,
PARROT_ARG_NAME_SC = PARROT_ARG_NAME | PARROT_ARG_STRING   | PARROT_ARG_CONSTANT

and

PARROT_ARG_NAME             = 0x0200,

But the switch expression is op->types[cur_arg - 1], which is a char, thus the 0x200 overflows, as the compiler says.

Change History

Changed 4 years ago by mikehh

It builds for me on Ubuntu 9.10 amd64

g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1

it does however generate a warning, but does not exit with an error:

src/pbc_merge.c: In function ‘void pbc_merge_ctpointers(parrot_interp_t*, pbc_merge_input**, int, PackFile_ByteCode*)’:
src/pbc_merge.c:664: warning: case label value exceeds maximum value for type

This is bug as far as I am concerned, but no tests fail:

All tests PASS (pre/post-config, make corevm/make coretest, smoke (#32107), fulltest) at r43787 - Ubuntu 9.10 amd64 (g++ with --optimize)

All tests PASS (pre/post-config, make corevm/make coretest, smoke (#32109), fulltest) at r43787 - Ubuntu 9.10 amd64 (g++)

Changed 4 years ago by cotto

  • status changed from new to closed
  • resolution set to fixed

This was fixed in r47388 by using enums in op_info_t instead of casting to/from char.

Note: See TracTickets for help on using tickets.