From: SourceForge.net <no...@so...> - 2009-03-20 23:09:18
|
Bugs item #2698805, was opened at 2009-03-20 23:09 Message generated for change (Tracker Item Submitted) made by sjborley You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Steven Borley (sjborley) Assigned to: Nobody/Anonymous (nobody) Summary: Expected scope rules fail with local enum Initial Comment: The following compiles, but I don't think it should (does not even give a warning). Scope of enum foo_tag should be local to foo(). static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } Similarly, the following does not compile but I feel it ought to... static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } The later gives gives... main.c:10: error 163: duplicate enum member 'e_foo' main.c:4: error 177: previously defined here main.c:10: error 0: Duplicate symbol 'e_foo', symbol IGNORED main.c:4: error 177: previously defined here main.c:10: error 51: typedef/enum 'foo_tag' duplicate. Previous definiton Ignored main.c:4: error 177: previously defined here I'm compiling the above with simply... sdcc main.c sdcc --version SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Mar 17 2009) (Mac OS X i386) For comparison, gcc errors on the first example, and is successful on the latter (the reverse of sdcc) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 |
From: SourceForge.net <no...@so...> - 2009-03-23 08:40:38
|
Bugs item #2698805, was opened at 2009-03-21 00:09 Message generated for change (Comment added) made by patryks You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Steven Borley (sjborley) Assigned to: Nobody/Anonymous (nobody) Summary: Expected scope rules fail with local enum Initial Comment: The following compiles, but I don't think it should (does not even give a warning). Scope of enum foo_tag should be local to foo(). static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } Similarly, the following does not compile but I feel it ought to... static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } The later gives gives... main.c:10: error 163: duplicate enum member 'e_foo' main.c:4: error 177: previously defined here main.c:10: error 0: Duplicate symbol 'e_foo', symbol IGNORED main.c:4: error 177: previously defined here main.c:10: error 51: typedef/enum 'foo_tag' duplicate. Previous definiton Ignored main.c:4: error 177: previously defined here I'm compiling the above with simply... sdcc main.c sdcc --version SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Mar 17 2009) (Mac OS X i386) For comparison, gcc errors on the first example, and is successful on the latter (the reverse of sdcc) ---------------------------------------------------------------------- Comment By: Patryk (patryks) Date: 2009-03-23 09:40 Message: There was a similiar scope problem (but with typedef), it's fixed now: 1925942: typedef defined inside fun. and used outside causes SIGSEGV https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1925942&group_id=599 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 |
From: SourceForge.net <no...@so...> - 2010-09-13 11:35:44
|
Bugs item #2698805, was opened at 2009-03-21 00:09 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Steven Borley (sjborley) Assigned to: Nobody/Anonymous (nobody) Summary: Expected scope rules fail with local enum Initial Comment: The following compiles, but I don't think it should (does not even give a warning). Scope of enum foo_tag should be local to foo(). static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } Similarly, the following does not compile but I feel it ought to... static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } The later gives gives... main.c:10: error 163: duplicate enum member 'e_foo' main.c:4: error 177: previously defined here main.c:10: error 0: Duplicate symbol 'e_foo', symbol IGNORED main.c:4: error 177: previously defined here main.c:10: error 51: typedef/enum 'foo_tag' duplicate. Previous definiton Ignored main.c:4: error 177: previously defined here I'm compiling the above with simply... sdcc main.c sdcc --version SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Mar 17 2009) (Mac OS X i386) For comparison, gcc errors on the first example, and is successful on the latter (the reverse of sdcc) ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2010-09-13 13:35 Message: Still present in SDCC 2.9.7 #5969. ---------------------------------------------------------------------- Comment By: Patryk (patryks) Date: 2009-03-23 09:40 Message: There was a similiar scope problem (but with typedef), it's fixed now: 1925942: typedef defined inside fun. and used outside causes SIGSEGV https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1925942&group_id=599 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 |
From: SourceForge.net <no...@so...> - 2011-12-27 19:43:26
|
Bugs item #2698805, was opened at 2009-03-20 16:09 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Steven Borley (sjborley) >Assigned to: Maarten Brock (maartenbrock) Summary: Expected scope rules fail with local enum Initial Comment: The following compiles, but I don't think it should (does not even give a warning). Scope of enum foo_tag should be local to foo(). static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } Similarly, the following does not compile but I feel it ought to... static void foo(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } static void bar(void) { enum foo_tag { e_foo }; volatile unsigned char a = e_foo; } void main(void) { foo(); bar(); } The later gives gives... main.c:10: error 163: duplicate enum member 'e_foo' main.c:4: error 177: previously defined here main.c:10: error 0: Duplicate symbol 'e_foo', symbol IGNORED main.c:4: error 177: previously defined here main.c:10: error 51: typedef/enum 'foo_tag' duplicate. Previous definiton Ignored main.c:4: error 177: previously defined here I'm compiling the above with simply... sdcc main.c sdcc --version SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Mar 17 2009) (Mac OS X i386) For comparison, gcc errors on the first example, and is successful on the latter (the reverse of sdcc) ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2011-12-27 11:43 Message: Fixed in SDCC 3.1.1 #7137. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2010-09-13 04:35 Message: Still present in SDCC 2.9.7 #5969. ---------------------------------------------------------------------- Comment By: Patryk (patryks) Date: 2009-03-23 01:40 Message: There was a similiar scope problem (but with typedef), it's fixed now: 1925942: typedef defined inside fun. and used outside causes SIGSEGV https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1925942&group_id=599 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2698805&group_id=599 |