Compilers Suck!

[8:46] brbarret@traal:ttyp0 XL% cat xlsucks.cc 
#include <memory>

int
main(int argc, char *argv[])
{
  return 0;
}
[8:46] brbarret@traal:ttyp0 XL% mkdir memory
[8:46] brbarret@traal:ttyp0 XL% xlc++ xlsucks.cc -o xlsucks
[8:46] brbarret@traal:ttyp0 XL% xlc++ -I. xlsucks.cc -o xlsucks
1540-0820 (S) Unable to read the file ./memory. Operation not permitted.
"./memory", line 1.0: 1540-0809 (W) The source file is empty.
[8:46] brbarret@traal:ttyp0 XL%

Yes, it’s opening a directory for reading, thinking it’s a file. Someone forgot the S_IFDIR check when they were stat()ing around looking for the header. This came up because Open MPI has a directory $(top_srcdir)/opal/memory/ and includes a global CFLAGS that includes -I$(top_srcdir)/opal and memory is a header file in the GNU C++ standard library that is included just about everywhere else, and instead of finding that memory, it was finding our directory. This took me a while to track down…