8044071: Print format/argument warnings
Reviewed-by: drchase, dholmes, lfoltan, twisti
--- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -135,7 +135,7 @@
if (TraceICs) {
ResourceMark rm;
tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
- instruction_address(),
+ p2i(instruction_address()),
callee->name_and_sig_as_C_string());
}
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -557,7 +557,8 @@
// QQQ this assert is invalid (or too strong anyway) sice _pc could
// be original pc and frame could have the deopt pc.
// assert(_pc == *O7_addr() + pc_return_offset, "frame has wrong pc");
- tty->print_cr("patch_pc at address 0x%x [0x%x -> 0x%x] ", O7_addr(), _pc, pc);
+ tty->print_cr("patch_pc at address " INTPTR_FORMAT " [" INTPTR_FORMAT " -> " INTPTR_FORMAT "]",
+ p2i(O7_addr()), p2i(_pc), p2i(pc));
}
_cb = CodeCache::find_blob(pc);
*O7_addr() = pc - pc_return_offset;
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -1202,7 +1202,7 @@
if ( j != last ) s->print(" - f%d", last);
s->print(" = %f", val);
s->fill_to(25);
- s->print_cr(" (0x%x)", val);
+ s->print_cr(" (0x%x)", *(int*)&val);
j = last + 1;
}
s->cr();
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -78,7 +78,7 @@
}
void NativeInstruction::print() {
- tty->print_cr(INTPTR_FORMAT ": 0x%x", addr_at(0), long_at(0));
+ tty->print_cr(INTPTR_FORMAT ": 0x%x", p2i(addr_at(0)), long_at(0));
}
void NativeInstruction::set_long_at(int offset, int i) {
@@ -142,7 +142,7 @@
}
void NativeCall::print() {
- tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination());
+ tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination()));
}
@@ -271,7 +271,7 @@
}
void NativeFarCall::print() {
- tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination());
+ tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination()));
}
bool NativeFarCall::destination_is_compiled_verified_entry_point() {
@@ -324,7 +324,7 @@
void NativeMovConstReg::print() {
- tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data());
+ tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, p2i(instruction_address()), data());
}
@@ -446,7 +446,7 @@
void NativeMovConstRegPatching::print() {
- tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data());
+ tty->print_cr(INTPTR_FORMAT ": mov reg, 0x%x", p2i(instruction_address()), data());
}
@@ -585,9 +585,10 @@
void NativeMovRegMem::print() {
if (is_immediate()) {
- tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset());
+ // offset is a signed 13-bit immediate, so casting it to int will not lose significant bits
+ tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), (int)offset());
} else {
- tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address());
+ tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address()));
}
}
@@ -730,9 +731,9 @@
void NativeMovRegMemPatching::print() {
if (is_immediate()) {
- tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset());
+ tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), offset());
} else {
- tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address());
+ tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address()));
}
}
@@ -863,7 +864,7 @@
void NativeJump::print() {
- tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, instruction_address(), jump_destination());
+ tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, p2i(instruction_address()), p2i(jump_destination()));
}
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -1722,15 +1722,15 @@
if (caller->is_interpreted_frame()) {
tty->print("interpreted ");
}
- tty->print_cr("caller fp=0x%x sp=0x%x", caller->fp(), caller->sp());
- tty->print_cr("save area = 0x%x, 0x%x", caller->sp(), caller->sp() + 16);
- tty->print_cr("save area = 0x%x, 0x%x", caller->fp(), caller->fp() + 16);
- tty->print_cr("interpreter fp=0x%x sp=0x%x", interpreter_frame->fp(), interpreter_frame->sp());
- tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->sp(), interpreter_frame->sp() + 16);
- tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->fp(), interpreter_frame->fp() + 16);
- tty->print_cr("Llocals = 0x%x", locals);
- tty->print_cr("Lesp = 0x%x", esp);
- tty->print_cr("Lmonitors = 0x%x", monitors);
+ tty->print_cr("caller fp=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->sp()));
+ tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->sp()), p2i(caller->sp() + 16));
+ tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->fp() + 16));
+ tty->print_cr("interpreter fp=" INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->sp()));
+ tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->sp()), p2i(interpreter_frame->sp() + 16));
+ tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->fp() + 16));
+ tty->print_cr("Llocals = " INTPTR_FORMAT, p2i(locals));
+ tty->print_cr("Lesp = " INTPTR_FORMAT, p2i(esp));
+ tty->print_cr("Lmonitors = " INTPTR_FORMAT, p2i(monitors));
}
if (method->max_locals() > 0) {
--- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -111,7 +111,7 @@
if (PrintMiscellaneous && (WizardMode || Verbose)) {
tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
- vtable_index, s->entry_point(),
+ vtable_index, p2i(s->entry_point()),
(int)(s->code_end() - s->entry_point()),
(int)(s->code_end() - __ pc()));
}
@@ -206,7 +206,7 @@
if (PrintMiscellaneous && (WizardMode || Verbose)) {
tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
- itable_index, s->entry_point(),
+ itable_index, p2i(s->entry_point()),
(int)(s->code_end() - s->entry_point()),
(int)(s->code_end() - __ pc()));
}
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -234,7 +234,7 @@
SIG_REGS(sc).u_regs[CON_G3],
SIG_REGS(sc).u_regs[CON_G4]);
st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
- " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT,
+ " G7=" INTPTR_FORMAT " Y=0x%x",
SIG_REGS(sc).u_regs[CON_G5],
SIG_REGS(sc).u_regs[CON_G6],
SIG_REGS(sc).u_regs[CON_G7],
@@ -285,7 +285,7 @@
st->cr();
st->cr();
- st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
+ st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
st->cr();
@@ -293,7 +293,7 @@
// point to garbage if entry point in an nmethod is corrupted. Leave
// this at the end, and hope for the best.
address pc = os::Linux::ucontext_get_pc(uc);
- st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
+ st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", p2i(pc));
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
@@ -453,7 +453,7 @@
&& pc < MacroAssembler::_verify_oop_implicit_branch[1] ) {
*stub = MacroAssembler::_verify_oop_implicit_branch[2];
warning("fixed up memory fault in +VerifyOops at address "
- INTPTR_FORMAT, fault);
+ INTPTR_FORMAT, p2i(fault));
return true;
}
return false;
--- a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Thu May 29 09:41:07 2014 +0000
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Thu May 29 16:01:13 2014 -0700
@@ -36,7 +36,7 @@
}
while (!feof(fp)) {
- if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) {
+ if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) {
if (strstr(cpu, "Niagara") != NULL) {
rv = true;
}