[llvm-dev] Function - replaceAllUsesWith (original) (raw)

Gaier, Bjoern via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 15 06:04:43 PST 2019


I could actually track down the cause of the problem:

mainModue->getFunction("puts")->replaceAllUsesWith( llvm::ConstantExpr::getPointerCast( llvm::ConstantInt::get(llvm::IntegerType::get(context, 64), 0xF), mainModue->getFunction("puts")->getType() ) ); The problem is the line where I receive the type of the function "puts", it will crash the application - when used as the parameter for "getPointerCast". I generated a new type, then the function didn't crashed anymore. Is there a way to copy the value? I want to ensure to use the correct type...

Kind greetings Björn

-----Original Message----- From: Tim Northover <t.p.northover at gmail.com> Sent: Dienstag, 15. Januar 2019 13:42 To: Gaier, Bjoern <Bjoern.Gaier at horiba.com> Cc: Stefan Gränitz <stefan.graenitz at gmail.com>; Mehdi AMINI <joker.eph at gmail.com>; llvm-dev <llvm-dev at lists.llvm.org> Subject: Re: [llvm-dev] Function - replaceAllUsesWith

On Tue, 15 Jan 2019 at 12:35, Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:

Sadly I have currently only a release build of LLVM7 with no assertions turned on...

That's definitely the first thing you should fix. Preferably a debug build too. The only reason you should ever be debugging against a release build of LLVM is if you have a Heisenbug that doesn't happen otherwise. It's a horrible experience.

So I just know that the line of code I posted is crashing. No output, no anything....just...Crash...

Even a release build can give you a backtrace if you attach a debugger, though as I've said I wouldn't normally bother.

Cheers.

Tim. Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika



More information about the llvm-dev mailing list