From ea94839bf6cc6e0e77d1a87478e74a32b3d24e98 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 17 Jan 2020 17:26:31 -0800 Subject: [PATCH] Fix alignment check The "is the .junk alignment directive correct" was returning true for subtype=None (not aligned), which caused execution to go down the wrong path and irritate an assert. --- SourceGen/AsmGen/GenCommon.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SourceGen/AsmGen/GenCommon.cs b/SourceGen/AsmGen/GenCommon.cs index f080391..24f67b1 100644 --- a/SourceGen/AsmGen/GenCommon.cs +++ b/SourceGen/AsmGen/GenCommon.cs @@ -439,12 +439,13 @@ namespace SourceGen.AsmGen { /// File offset of directive. /// Format descriptor. /// Offset to address map. - /// True if the .junk alignment directive is correct. + /// True if the .junk alignment directive is correct, false if it's + /// incorrect or not an alignment sub-type (e.g. None). public static bool CheckJunkAlign(int offset, FormatDescriptor dfd, CommonUtil.AddressMap addrMap) { Debug.Assert(dfd.FormatType == FormatDescriptor.Type.Junk); if (dfd.FormatSubType == FormatDescriptor.SubType.None) { - return true; + return false; } Debug.Assert(dfd.IsAlignedJunk);