Hi,

What is the version of clang used on tryserver?

The local clang-8 I have on my linux PC crashes due to internal compiler error during optimization pass, and I want to know what version is used on tryserver.

I have been using GCC for compiling TB locally and intend to do so just because the diversity of compilers would help us catch subtle issues in source code. But recently I noticed a subtle binary behavior difference of the local binary during the testing locally and of the tryserver binary during testing on the trysever.
I need to figure out what happens using clang compiler locally.

That is why I want to know the clang-xxx version on the tryserver.

Detailed Background:

After recreating my local patches to match the great clang-reformatting of the source tree after so many months, I was happy to see that my patches for TB to enable buffering for writing messages to files are almost done. It passes |make mozmill| with only a couple of errors [this was not the case in last July time frame. I saw many, probably 400+ errors then, that made me give up for the effort for a few months.], and I now see four+ errors of xpcshell-test locally.


Now though, I am stunned to see MANY crashes triggered by MOZ_ASSERT on tryserver runs.

For example, you can see such instances in

https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=258708674

In the xpcshell test for linux64 debug version, you see failed xpcshell test, and when you click on X1,

https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=258708674&repo=try-comm-central&lineNumber=2225

you will see an error such as follows:

20:10:35 WARNING - PROCESS-CRASH | comm/mailnews/imap/test/unit/test_imapFilterActions.js | application crashed [@ nsBufferedStream::Init(nsISupports*, unsigned int)]

I though great, this will help me to focus on where I reset some stream variables to nullptr too early, etc. I am setting stream pointers to nullptr after closing it to avoid
double Close() calls on the underlying stream.

EXCEPT FOR one thing. This assert does NOT trigger locally AT ALL.
I am very puzzled.

I am using linux AMD64 as local development platform.

After scratching my head for a while and experimented inserting variable dumps and compare the test runs locally and tryserver, I came to a conclusion.

I am using GCC for local development (gcc-7 and g++-7 to be exact) and tryserver presumably uses clang for compilation. I am building full debug build.: I even pass -DDEBUG=1 on compiler line just in case.

I am afraid that there are probably very subtle difference between the two compilers.: GCC on my local PC does not produce code that will trigger the MOZ_ASSERT() while
clang on tryserver does.

Why the different behavior?

1. GCC or g++ to be exact and  clang-8 may generate slightly different code for a valid piece of code. In this case, one of the compiler must be broken.

2. These compilers may handle "undefined behavior" of the source code in the parlance of "ISO C++" in a different way.

If the problem of different behavior of binaries locally and on tryserver is due to the reason 2, then I think we should be happy. The difference of two compilers warns us of construct in mozilla source tree that results in undefined behavior at an early stage. If one day, clang starts to handle the undefined behavior differently, we may be in for a surprise.
Such constructs won't be noticeable easily if we use only clang.

Anyway, I thought I would switch to clang for local compiling temporarily to see where the problem lies.

"./mach boostrap" installed clang-8 under /home/ishikawa/.mozbuild/clang/bin/clang-8 and so I thought I would use it.

However, this binary crashed miserably during optimization pass with a message that prompts me to report the issue to llvm.org, and I am in the process of doing it. (The bugzilla acount of llvm.org cannot be created automatically due to excessive spams. So I am waiting for the moderator there to open an account for me.)


BTW, the code in question that trigger the behavior is the compilation of the code here.
This line is added by my patch.

  // XXX TODO/FIXME should the second parameter needs to be
  //   mCopyState->m_fileStream.forget(), /* original */
  //   mCopyState->m_fileStream (simply?)
  //   The second form produces the following error.
  //   ... comm/mailnews/local/src/nsLocalMailFolder.cpp: In member function ‘nsresult nsMsgLocalMailFolder::InitCopyMsgHdrAndFileStream()’:   //  .../comm/mailnews/local/src/nsLocalMailFolder.cpp:2002:46: error: could not convert ‘((nsMsgLocalMailFolder*)this)->nsMsgLocalMailFolder::mCopyState->nsLocalMailCopyState::m_fileStream’ from ‘nsCOMPtr<nsIOutputStream>’ to ‘already_AddRefed<nsIOutputStream>’
  // mCopyState->m_fileStream,
  // ~~~~~~~~~~~~^~~~~~~~~~~~

  //   I suspect a subtle compiler issue: clang-c++ vs. g++

  PSTREAM2(mCopyState->m_fileStream, "before NS_NewBufferedOutputStream");
  nsresult rv2
    = NS_NewBufferedOutputStream(getter_AddRefs(mCopyState->m_fileStream),
mCopyState->m_fileStream.forget(),  <=== It seems this can be nullptr in clang-8 version???
                                 64 * 1024 );

I cannot exactly recall why I added .forget() to mCopyState->m_fileSream.
Probably to seek to the beginning of the stream?
But as the comment above shows if I do not add .forget(), the compilation fails even. I am not even quite sure what is already_AddRefed modifier is (I can guess it is for garbage collection to avoid memory leak, etc.)

Anyway, I would appreciate to hear the version of clang-xxx that I need to use for TB compilation.

I will report whatever the real causes of the different behavior once I sort the out the compiler issues.

TIA

Chiaki


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to