digitalmars.D.learn - warning: pointer not aligned at address
- Andrew Edwards (18/18) Apr 11 2017 When compiled with any dmd compiler from 2.069.0 through present
- Andrew Edwards (28/28) Apr 11 2017 Conveniently the site is down immediately after I posted that so
- Matt Whisenhunt (4/5) Apr 11 2017 Are you running macOS and recently installed an update to Xcode?
- Andrew Edwards (4/9) Apr 12 2017 Yes, I do indeed use macOS and am on the latest version. I spun
When compiled with any dmd compiler from 2.069.0 through present (2.074.0), https://rosettacode.org/wiki/100_doors#D produces the following linker warning: ld: warning: pointer not aligned at address 0x10004FCEB (_D51TypeInfo_S3std5range13__T4iotaTiTmZ4iotaFimZ6Result6__initZ + 24 from doors100.o) [65 other lines removed for brevity] ld: warning: pointer not aligned at address 0x100050C7D (_D11TypeInfo_xb6__initZ + 16 from doors100.o) specific compilers checked: dmd-2.068.0 dmd-2.068.1 dmd-2.068.2 dmd-2.069.0 dmd-2.070.0 dmd-2.071.2 dmd-2.073.1 dmd-2.073.2 dmd-2.074.0 What's the proper way to address these warnings? The code is linked and works as expected but, to me, there is just something about those warnings that cries out for attention. Is there something I can do to align this code or is this something that needs to be addressed in the compiler? Thanks, Andrew
Apr 11 2017
Conveniently the site is down immediately after I posted that so here is the code to which I was referring: import std.stdio, std.algorithm, std.range; enum DoorState : bool { closed, open } alias Doors = DoorState[]; Doors flipUnoptimized(Doors doors) pure nothrow { doors[] = DoorState.closed; foreach (immutable i; 0 .. doors.length) for (ulong j = i; j < doors.length; j += i + 1) if (doors[j] == DoorState.open) doors[j] = DoorState.closed; else doors[j] = DoorState.open; return doors; } Doors flipOptimized(Doors doors) pure nothrow { doors[] = DoorState.closed; for (int i = 1; i ^^ 2 <= doors.length; i++) doors[i ^^ 2 - 1] = DoorState.open; return doors; } void main() { auto doors = new Doors(100); foreach (const open; [doors.dup.flipUnoptimized, doors.dup.flipOptimized]) iota(1, open.length + 1).filter!(i => open[i - 1]).writeln; }
Apr 11 2017
ld: warning: pointer not aligned at address 0x100050C7DAre you running macOS and recently installed an update to Xcode? I ran into this today as well. Looks like other have too: https://issues.dlang.org/show_bug.cgi?id=17289
Apr 11 2017
On Wednesday, 12 April 2017 at 03:18:32 UTC, Matt Whisenhunt wrote:Yes, I do indeed use macOS and am on the latest version. I spun up a Ubuntu vm and in works correctly there. Thanks.ld: warning: pointer not aligned at address 0x100050C7DAre you running macOS and recently installed an update to Xcode? I ran into this today as well. Looks like other have too: https://issues.dlang.org/show_bug.cgi?id=17289
Apr 12 2017