Hi Ingo, > Gesendet: Donnerstag, 14. März 2013 um 14:50 Uhr > Von: "Ingo Weinhold" <ingo_weinhold@xxxxxx> [...] > > The situation is looking like this check is removed for some non-obvious > > reasons. I suspect, that because NULL-input case is not specified in > > standard for strdup the compiler make some assumptions that strdup never be > > called with NULL parameter so this check is useless. Are there other ideas? > > Could you please provide a disassembly of strdup() (copy from the result > of "objdump -D libroot.so") with and without the option. -fno-tree-vrp is not set: 0009aa60 <strdup>: 9aa60: 55 push %ebp 9aa61: 89 e5 mov %esp,%ebp 9aa63: 57 push %edi 9aa64: 56 push %esi 9aa65: 53 push %ebx 9aa66: 83 ec 28 sub $0x28,%esp 9aa69: e8 00 00 00 00 call 9aa6e <strdup+0xe> 9aa6e: 5b pop %ebx 9aa6f: 81 c3 3e 01 04 00 add $0x4013e,%ebx 9aa75: 8b 7d 08 mov 0x8(%ebp),%edi 9aa78: 57 push %edi 9aa79: e8 22 8f f8 ff call 239a0 <strlen@plt> 9aa7e: 8d 50 01 lea 0x1(%eax),%edx 9aa81: 89 14 24 mov %edx,(%esp) 9aa84: 89 55 e4 mov %edx,-0x1c(%ebp) 9aa87: e8 64 67 f8 ff call 211f0 <malloc@plt> 9aa8c: 83 c4 10 add $0x10,%esp 9aa8f: 89 c6 mov %eax,%esi 9aa91: 85 c0 test %eax,%eax 9aa93: 8b 55 e4 mov -0x1c(%ebp),%edx 9aa96: 74 0c je 9aaa4 <strdup+0x44> 9aa98: 50 push %eax 9aa99: 52 push %edx 9aa9a: 57 push %edi 9aa9b: 56 push %esi 9aa9c: e8 7f 64 f8 ff call 20f20 <memcpy@plt> 9aaa1: 83 c4 10 add $0x10,%esp 9aaa4: 8d 65 f4 lea -0xc(%ebp),%esp 9aaa7: 89 f0 mov %esi,%eax 9aaa9: 5b pop %ebx 9aaaa: 5e pop %esi 9aaab: 5f pop %edi 9aaac: 5d pop %ebp 9aaad: c3 ret -fno-tree-vrp is set: 0009aa60 <strdup>: 9aa60: 55 push %ebp 9aa61: 89 e5 mov %esp,%ebp 9aa63: 57 push %edi 9aa64: 56 push %esi 9aa65: 53 push %ebx 9aa66: 83 ec 1c sub $0x1c,%esp 9aa69: e8 00 00 00 00 call 9aa6e <strdup+0xe> 9aa6e: 5b pop %ebx 9aa6f: 81 c3 3e 01 04 00 add $0x4013e,%ebx 9aa75: 8b 7d 08 mov 0x8(%ebp),%edi 9aa78: 31 f6 xor %esi,%esi 9aa7a: 85 ff test %edi,%edi 9aa7c: 74 2f je 9aaad <strdup+0x4d> 9aa7e: 83 ec 0c sub $0xc,%esp 9aa81: 57 push %edi 9aa82: e8 19 8f f8 ff call 239a0 <strlen@plt> 9aa87: 8d 50 01 lea 0x1(%eax),%edx 9aa8a: 89 14 24 mov %edx,(%esp) 9aa8d: 89 55 e4 mov %edx,-0x1c(%ebp) 9aa90: e8 5b 67 f8 ff call 211f0 <malloc@plt> 9aa95: 83 c4 10 add $0x10,%esp 9aa98: 89 c6 mov %eax,%esi 9aa9a: 85 c0 test %eax,%eax 9aa9c: 8b 55 e4 mov -0x1c(%ebp),%edx 9aa9f: 74 0c je 9aaad <strdup+0x4d> 9aaa1: 50 push %eax 9aaa2: 52 push %edx 9aaa3: 57 push %edi 9aaa4: 56 push %esi 9aaa5: e8 76 64 f8 ff call 20f20 <memcpy@plt> 9aaaa: 83 c4 10 add $0x10,%esp 9aaad: 8d 65 f4 lea -0xc(%ebp),%esp 9aab0: 89 f0 mov %esi,%eax 9aab2: 5b pop %ebx 9aab3: 5e pop %esi 9aab4: 5f pop %edi 9aab5: 5d pop %ebp 9aab6: c3 ret --- Kind Regards, S.Zharski