From: <no...@so...> - 2002-12-28 16:30:20
|
Bugs item #659424, was opened at 2002-12-28 08:30 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=659424&group_id=599 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: result of sizeof for 2d arrays is wrong Initial Comment: Sizeof calculate a wrong arraysize for a "open" array. The version is SDCC Version 2.3.2 This sample shold return 6 , not 4. ---------------------------- volatile unsigned char test; code unsigned char buf[][2]={{0,1},{2,3},{4,5}}; main() { test=sizeof(buf); } ---------------------------- 0038 75 08 04 122 mov _test,#0x04 003B 123 00101$: 003B 22 124 ret 125 .area CSEG (CODE) 003C 126 _buf: 003C 00 127 .db #0x00 003D 01 128 .db #0x01 003E 02 129 .db #0x02 003F 03 130 .db #0x03 0040 04 131 .db #0x04 0041 05 132 .db #0x05 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=659424&group_id=599 |
From: SourceForge.net <no...@so...> - 2003-01-05 19:12:21
|
Bugs item #659424, was opened at 2002-12-28 08:30 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=659424&group_id=599 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: result of sizeof for 2d arrays is wrong Initial Comment: Sizeof calculate a wrong arraysize for a "open" array. The version is SDCC Version 2.3.2 This sample shold return 6 , not 4. ---------------------------- volatile unsigned char test; code unsigned char buf[][2]={{0,1},{2,3},{4,5}}; main() { test=sizeof(buf); } ---------------------------- 0038 75 08 04 122 mov _test,#0x04 003B 123 00101$: 003B 22 124 ret 125 .area CSEG (CODE) 003C 126 _buf: 003C 00 127 .db #0x00 003D 01 128 .db #0x01 003E 02 129 .db #0x02 003F 03 130 .db #0x03 0040 04 131 .db #0x04 0041 05 132 .db #0x05 ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-01-05 11:13 Message: Logged In: NO I think that the function checkDecl (symbol * sym, int isProto) in SDCCsymt.c is the Problem. This function inserts the second dimension in the open dimenion instead of the count of elements. The sizeof this array is 4 but shold be 2. code unsigned char tmp1[][2]={{0,1}}; tmp1[][2]={{1,2}}; The cdb-line is S:G$tmp1$0$0({4}DA2,DA2,SC:U),D,0,0 the same for code unsigned char tmp2[][4]={{0,1,1,3},{2,3,3,3}}; S:G$tmp2$0$0({16}DA4,DA4,SC:U),D,0,0 g....@gm... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=659424&group_id=599 |
From: SourceForge.net <no...@so...> - 2003-01-11 14:03:42
|
Bugs item #659424, was opened at 2002-12-28 17:30 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=659424&group_id=599 Category: None >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Johan Knol (johanknol) Summary: result of sizeof for 2d arrays is wrong Initial Comment: Sizeof calculate a wrong arraysize for a "open" array. The version is SDCC Version 2.3.2 This sample shold return 6 , not 4. ---------------------------- volatile unsigned char test; code unsigned char buf[][2]={{0,1},{2,3},{4,5}}; main() { test=sizeof(buf); } ---------------------------- 0038 75 08 04 122 mov _test,#0x04 003B 123 00101$: 003B 22 124 ret 125 .area CSEG (CODE) 003C 126 _buf: 003C 00 127 .db #0x00 003D 01 128 .db #0x01 003E 02 129 .db #0x02 003F 03 130 .db #0x03 0040 04 131 .db #0x04 0041 05 132 .db #0x05 ---------------------------------------------------------------------- >Comment By: Bernhard Held (bernhardheld) Date: 2003-01-11 15:05 Message: Logged In: YES user_id=203539 Fixed by Johan. The bug was also exposed in float.c of the regression tests. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-01-05 20:13 Message: Logged In: NO I think that the function checkDecl (symbol * sym, int isProto) in SDCCsymt.c is the Problem. This function inserts the second dimension in the open dimenion instead of the count of elements. The sizeof this array is 4 but shold be 2. code unsigned char tmp1[][2]={{0,1}}; tmp1[][2]={{1,2}}; The cdb-line is S:G$tmp1$0$0({4}DA2,DA2,SC:U),D,0,0 the same for code unsigned char tmp2[][4]={{0,1,1,3},{2,3,3,3}}; S:G$tmp2$0$0({16}DA4,DA4,SC:U),D,0,0 g....@gm... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=659424&group_id=599 |