Fixed a Bug Crashing Clang

An ill-formed C++ code snippet Before the fix, this following C++ snippet would crash Clang. From the bug report, we can see how a user might accidentally omit the function name when they meant to declare a member function on line 3. To many people’s surprise, line 3 is actually parsed as a member variable declaration. The parantheses are insignificant here unlike when declaring a pointer to function or array. So line 3 is essentially T A<T>{};....

March 24, 2022 · 張博堯 (Chang, Po-Yao)

C++ Trivia;

I was browsing 🫣 the latest working draft of the ISO C++ Standard (https://eel.is/c++draft/) and then I found that what a single semicolon is called grammatically depends on where it appears. Cool beans 😎! Here’s a screenshot illustrating my findings (engorgio): The top half is a piece of valid C++ code stored in sc.cpp and the bottom half is its Clang AST dump with unimportant parts removed. The ; in the global scope on line 1 of sc....

March 1, 2022 · 張博堯 (Chang, Po-Yao)

The Bug Strikes Back: LLDB Bugs Lurking for Over a Decade

The Issue One day, I was wondering how dynamic function call works. I thought I’d start with a simple puts call like in this C snippet. #include <stdio.h> int main(void) { puts("Hello\n"); } To see it going through the Procedure Linkage Table (PLT) in the context of lazy binding on x86_64 Linux LIVE, naturally, LLDB came to my mind. To my dismay, instead of something relevant to puts there were only these ugly and unidentifiable ___lldb_unnamed_symbol36 in the disaseembly on LLDB 13....

January 7, 2022 · 張博堯 (Chang, Po-Yao)

ABI Incompatibility of libc++ and libstdc++ and C++ Inline Namespace

I ran into linker errors similar to the screenshot below in November 2021. After some close inspection, I realized this was a result of mixing 2 C++ standard libraries, namely libc++ and libstdc++. I was unkowningly 😱 compiling TVM with libc++’s headers while linking it against LLVM which was compiled with libstdc++’s headers and linked against libstdc++. A Simple Example Here is a simple example illustrating what’s happening. Source Files Given 2 C++ souce files:...

January 6, 2022 · 張博堯 (Chang, Po-Yao)

Set Up an SSD for Your Tesla on a Mac

Foreword Tesla intriduced custom light show in its holiday update, and I would like to put Tesla dash cam, music, boombox, and custom light show all in one storage device (assumed to be an SSD in this post). By doing this, I can put my SSD in the glove box, which is locked in the case of a breakin. This can be achieved by partitioning the storage device into 4 partitions, during which I found it was a PITA to do with file system other than APFS....

December 31, 2021 · 張博堯 (Chang, Po-Yao)

Set up a blog using Hugo

本文紀錄如何用Hugo建立blog,並部署到GitHub Pages。 ...

March 7, 2020 · 張博堯 (Chang, Po-Yao)