Some regression has been reported with Delphi 10.4.1 and SynPDF.

From the Github issue description: Generating a PDF via VLCCanvas and TPdfDocumentGDI causes access violation when compiled with Delphi 10.4.1 with record field alignment compiler option set to "byte" or "off". When this option is set to either of "word", "double word" or "quad word", the PDF gets created without errors. The same exact code works fine when compiled with Delphi 10.4 (patch 3), regardless of the field alignment flag.

Sadly, I don't have access to Delphi 10.4.1 since I don't have any commercial licence, and I am waiting for the Community Edition - which is still 10.3 IIRC. So I couldn't debug the root cause and fill a JIRA ticket to EMB. We tried to add a {$A+} at the beginning of the unit, to force the default record alignment. And it seemed to work. So we included the directive for all of our units, in the shared file, which is included in every of our source code units.

This blog entry is mainly to notify about this issue, and be able to share the solution/workaround we found, which could be investigated more deeply by Delphi users of the 10.4.1 revision. I guess that this problem may occur for other projects, when calling raw API.

Maybe it was a righteous fix introduced in 10.4.1, and the previous behavior of the compiler may have been incorrect: perhaps an explicit {$A+} is required when working with records... but at least, it breaks existing code, so spreading the info may help...

So feedback is welcome in our forum, if you wish to!


It sounds definitively like a bug/regression of 10.4.1. Reported initially as RSP-30787 and more specifically RSP-30890. Thanks François and Stefan for the good investigation in Delphi Praxis!

To be honest, setting an alignment to "byte" for a whole project is a pretty weird idea, and should never be done in practice. Default alignment is good for performance and compatibility. If you need no alignment for a record or a class, just use {$A-} ...{$A+} locally.