Stream: compiler development

Topic: debugging alignment issues


view this post on Zulip Anton (Aug 12 2024 at 12:32):

How can I investigate possible alignment issues when there is a segfault?
Once I know, I can add that to our debug_tips.md.

view this post on Zulip Brendan Hansknecht (Aug 12 2024 at 17:33):

Do you have a concrete example or error?

view this post on Zulip Anton (Aug 12 2024 at 17:38):

Yeah, this is the one I want to solve. We've had alignment issues before so I really wanted to write down a general procedure to investigate and fix them if that is possible.

view this post on Zulip Brendan Hansknecht (Aug 13 2024 at 00:10):

I'm not sure of a good generic guide for those type of issues. They tend to be low level and finicky. Aside from saying run with valgrind/gdb/lldb and look at both llvm ir generation. I don't think I have any sort of generic advise.

view this post on Zulip Brendan Hansknecht (Aug 13 2024 at 00:10):

Probably this needs some pretty specific compiler internal errors to figure out. In this case, it is almost certainly a very specific llvm ir issue.

view this post on Zulip Luke Boswell (Aug 13 2024 at 00:24):

Sightly offtopic, but you fuzzed the stdlib a fair bit didn't you? This issue looks like it's in List builtin. Or is this more codegen on the roc side?

view this post on Zulip Luke Boswell (Aug 13 2024 at 00:27):

Nvm, you already gave an idea

I guess the issue is somehow with lambda closure capture inputs. I wonder if they are aligned correctly.

view this post on Zulip Brendan Hansknecht (Aug 13 2024 at 00:43):

Somehow this is caused by a combination of:

  1. Closure captures
  2. Join point looping
  3. Using allocas to store data between loops instead of phi nodes

view this post on Zulip Luke Boswell (Aug 13 2024 at 01:09):

I can confidently say I don't know what any of those mean... :sweat_smile:

Hopefully someday I'll get there. :smiley:


Last updated: Jul 06 2025 at 12:14 UTC