From 9299735c75ba99347c7280b2e73064bef693989f Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 15 Jul 2010 17:13:33 +0000 Subject: Disable strict aliasing explicitly in the project makefiles, as this is apparently enabled by default in newer AVR-GCC builds, and aliasing is used heavily for type-punning through the LUFA and third party library's codebase. --- Demos/Device/LowLevel/MassStorage/Lib/SCSI.c | 4 ++-- Demos/Device/LowLevel/MassStorage/makefile | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Demos/Device/LowLevel/MassStorage') diff --git a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c index 46c71c35c..05c9265dd 100644 --- a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c +++ b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c @@ -136,7 +136,7 @@ bool SCSI_DecodeSCSICommand(void) */ static void SCSI_Command_Inquiry(void) { - uint16_t AllocationLength = SwapEndian_16(*(uint32_t*)&CommandBlock.SCSICommandData[3]); + uint16_t AllocationLength = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[3]); uint16_t BytesTransferred = (AllocationLength < sizeof(InquiryData))? AllocationLength : sizeof(InquiryData); @@ -259,7 +259,7 @@ static void SCSI_Command_ReadWrite_10(const bool IsDataRead) BlockAddress = SwapEndian_32(*(uint32_t*)&CommandBlock.SCSICommandData[2]); /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */ - TotalBlocks = SwapEndian_16(*(uint32_t*)&CommandBlock.SCSICommandData[7]); + TotalBlocks = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[7]); /* Check if the block address is outside the maximum allowable value for the LUN */ if (BlockAddress >= LUN_MEDIA_BLOCKS) diff --git a/Demos/Device/LowLevel/MassStorage/makefile b/Demos/Device/LowLevel/MassStorage/makefile index 6d0163db7..1680e501f 100644 --- a/Demos/Device/LowLevel/MassStorage/makefile +++ b/Demos/Device/LowLevel/MassStorage/makefile @@ -215,6 +215,7 @@ CFLAGS += -ffunction-sections CFLAGS += -fno-inline-small-functions CFLAGS += -fpack-struct CFLAGS += -fshort-enums +CFLAGS += -fno-strict-aliasing CFLAGS += -Wall CFLAGS += -Wstrict-prototypes CFLAGS += -Wundef -- cgit v1.2.3