Bugzilla – Bug 305
LLVM tools will happily spew bytecode onto your terminal
Last modified: 2004-04-04 19:39:51
You need to log in before you can comment on or make changes to this bug.
Currently, if you say "opt -pass foo.bc", opt will run the pass and then happily (but uselessly) spew the bytecode onto your terminal. This is liable to mess up your terminal modes. The workaround is well- known: you have to specify an output file or redirect stdout. This problem is common to many llvm tools. If autoconf finds that the isatty() call is available, any llvm tool (including opt) that outputs bytecode should refuse to output it onto your terminal -- instead, you should get an error message. In addition, any llvm tool that reads bytecode should refuse to read it from a terminal.
Oooh, that would be nice. One request though: "opt a.bc -o - -f" should still force spewage, though I'm not sure why someone would want this. That way the error message could say "warning, I would have spewed. Use -f if you really want me to" :) -Chris
What's wrong with the current -disable-output option?
The point is to protect you from ACCIDENTALLY causing bytecode spewage. -Chris
Ok, I fixed opt to check to see if the output is a terminal, and if so, refuse to output a bytecode file. Before we close this bug, I would appreciate it if someone could autoconfiscate this patch: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040329/013422.html While it's possible to add support for this to extract, gccld, gccas, llvm-link, llvm-as, and llvm-ar, I don't really think it's worth it. If someone disagrees, feel free to go ahead and fix them. :) -Chris
This is now fixed. opt will no longer spew bytecode files to a TTY unless the -f option is specified. -Chris