Hi all, The attached patch fixes several uninitialized variable warnings for the CygWin and Win32 builds by assigning values. These warnings seem to indicate that 'gcc -O2' does not work as well for those targets, but this will also solve problems when using less optimization (as indicated by my comment with an earlier patch [1]):
""" Interestingly, gcc reports some "possibly used uninitialized" warnings in the at91sam7.c file when -O or -O1 is used. When -O2 kicks in, the compiler catches its oversight. I think the best resolution will be to factor the associated code into smaller functions, but that can wait. """ I continue to think that factoring the code would be a better solution, but this patch at least covers all of our base in the meantime. I think this fixes a genuine bug in the pic32mx_info function, too. Cheers, Zach [1] - https://lists.berlios.de/pipermail/openocd-development/2009-April/005412.html
Index: src/flash/at91sam7.c =================================================================== --- src/flash/at91sam7.c (revision 1478) +++ src/flash/at91sam7.c (working copy) @@ -322,11 +322,11 @@ u16 bnk, sec; u16 arch; u32 cidr; - u8 banks_num; - u16 num_nvmbits; - u16 sectors_num; - u16 pages_per_sector; - u16 page_size; + u8 banks_num = 0; + u16 num_nvmbits = 0; + u16 sectors_num = 0; + u16 pages_per_sector = 0; + u16 page_size = 0; u32 ext_freq; u32 bank_size; u32 base_address = 0; Index: src/flash/pic32mx.c =================================================================== --- src/flash/pic32mx.c (revision 1478) +++ src/flash/pic32mx.c (working copy) @@ -611,7 +611,7 @@ mips32_common_t *mips32 = target->arch_info; mips_ejtag_t *ejtag_info = &mips32->ejtag_info; int i; - u16 num_pages; + u16 num_pages = 0; u32 device_id; int page_size; @@ -704,7 +704,7 @@ mips32_common_t *mips32 = target->arch_info; mips_ejtag_t *ejtag_info = &mips32->ejtag_info; u32 device_id; - int printed, i; + int printed = 0, i; device_id = ejtag_info->idcode;
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development