CodegenLIR.cpp generates "cast to pointer from integer of different size" errors with GCC 4.6

UNCONFIRMED
Assigned to

Status

Tamarin
Virtual Machine
P3
normal
UNCONFIRMED
7 years ago
6 years ago

People

(Reporter: Ollie Wild, Assigned: Ollie Wild)

Tracking

(Blocks: 1 bug)

unspecified
Q1 12 - Brannan
x86_64
Linux
Bug Flags:
flashplayer-injection -
flashplayer-qrb +

Details

Attachments

(2 attachments)

(Assignee)

Description

7 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1

Steps to reproduce:

I compiled tamarin on a Linux x86_64 machine with GCC 4.6 and -Wno-unused-but-set-variable -fno-strict-aliasing (needed to get rid of other common errors).


Actual results:

The build failed with:

/home/aaw/src/tamarin-central/core/CodegenLIR.cpp: In member function 'nanojit::LIns* avmplus::CodegenLIR::leaIns(int32_t, nanojit::LIns*)':
/home/aaw/src/tamarin-central/core/CodegenLIR.cpp:406:64: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
/home/aaw/src/tamarin-central/core/CodegenLIR.cpp: In member function 'virtual void avmplus::CodegenLIR::writeBlockStart(avmplus::FrameState*)':
/home/aaw/src/tamarin-central/core/CodegenLIR.cpp:1680:47: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
/home/aaw/src/tamarin-central/core/CodegenLIR.cpp: In member function 'void avmplus::CodegenLIR::emitPrep(avmplus::FrameState*)':
/home/aaw/src/tamarin-central/core/CodegenLIR.cpp:2893:43: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1plus: all warnings being treated as errors


Expected results:

It should compile.  I believe the attached patch fixes this, but it would be good to have someone more familiar with this code take a look.
(Assignee)

Comment 1

7 years ago
Created attachment 559387 [details] [diff] [review]
proposed fix

Updated

7 years ago
Component: Library → Virtual Machine
OS: All → Linux
QA Contact: library → vm
Hardware: All → x86_64

Comment 2

7 years ago
Comment on attachment 559387 [details] [diff] [review]
proposed fix

Thanks for the patch!

Instructions like LIR_addp and LIR_stp require pointer-sized operands, and InsConst() always generates a 32-bit int constant.  Those call sites do intend to upcast the int to a pointer-sized int (int->intptr_t) then re-use InsConstPtr, so a better fix would be (e.g.)

  InsConstPtr((void*)(intptr_t)disp);

And so on for the other error sites.  If you can add a comment while you're in there that would be great too.
Attachment #559387 - Flags: review-

Updated

7 years ago
Assignee: nobody → aaw
Flags: flashplayer-qrb+
Flags: flashplayer-injection-
Priority: -- → P3
Target Milestone: --- → Q1 12 - Brannan
(Assignee)

Comment 3

7 years ago
Created attachment 559890 [details] [diff] [review]
New patch.

Updated patch attached.  Note that I don't have write access to the repository, so someone will have to apply this for me.

Updated

7 years ago
Attachment #559890 - Flags: review?(edwsmith)

Updated

7 years ago
Attachment #559890 - Flags: review?(edwsmith) → review+

Comment 4

7 years ago
This patch does not apply cleanly to tamarin-redux, in fact the code in TR looks nothing like what this patch says it looks like.  Which version of tamarin, and which changeset, is this based on?  The changeset in the patch (fbecf6c8a86f) does not seem to exist in tamarin-redux.
(Assignee)

Comment 5

7 years ago
This was generated against the code in tamarin-central.

Comment 6

7 years ago
Ollie, can you rebase the patch to be based on the tamarin-redux baseline.  TR is the developmental baseline.
Blocks: 753029
You need to log in before you can comment on or make changes to this bug.