<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Commit 45148 fixes the bug below.<div><br class="webkit-block-placeholder"></div><div>Thanks for the report (Oliver),</div><div><br class="webkit-block-placeholder"></div><div>snaroff</div><div><br><div><div>On Dec 15, 2007, at 11:30 AM, Steve Naroff wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have a look later today...<div><br class="webkit-block-placeholder"></div><div>Glad to hear you are feeling better!</div><div><br class="webkit-block-placeholder"></div><div>snaroff</div><div><br><div><div>On Dec 15, 2007, at 9:38 AM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 14, 2007, at 11:57 PM, Oliver Hunt wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">So i'm looking at this failure:<div><div>typedef struct { char name[100]; } entry;</div><div>char f1(entry *e) { return *e->name; }</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>The problem appears to be <span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: #3f6e74">CodeGenFunction</span>::EmitScalarExpr<span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "> being called on e->name as it believes</span></span></div><div>e->name is an array type rather than a scalar, so we assert.</div><div><br class="webkit-block-placeholder"></div><div>I'm not sure what the appropriate correction should be -- should i fix </div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #3f6e74">CodeGenFunction</span>::EmitLoadOfLValue<span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">So that it can handle an array type -- emitting an array type as an lvalue should just be to emit a getElementPtr(array, 0)</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br class="webkit-block-placeholder"></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">Or alternatively have a step during merge to convert *array to array[0]</span></font></div></div></div></div></blockquote><br></div><div>Hi Oliver,</div><div><br class="webkit-block-placeholder"></div><div>Sorry for the delay, I've been majorly sick since thursday night. I don't think this is a codegen bug, I think it's a sema bug:</div><div><br class="webkit-block-placeholder"></div><div>$ clang t3.c -ast-dump</div><div>typedef char *__builtin_va_list;</div><div>typedef struct <anonymous> entry;</div><div><br class="webkit-block-placeholder"></div><div>char f1(entry *e)</div><div>(CompoundStmt 0x8061e0 <t3.c:2:19, col:38></div><div> (ReturnStmt 0x8061d0 <col:21, col:32></div><div> (UnaryOperator 0x8061b0 <col:28, col:32> 'char' prefix '*'</div><div> (MemberExpr 0x806180 <col:29, col:32> 'char [100]' ->name 0x805f00</div><div> (DeclRefExpr 0x806160 <col:29> 'entry *' ParmVar='e' 0x806120)))))</div><div><br class="webkit-block-placeholder"></div><div>Sema is properly inferring that the * has type char, but it isn't inserting an implicit cast. I'd expect to see something like this:</div><div><br class="webkit-block-placeholder"></div><div><div>clang t3.c -ast-dump</div><div>typedef char *__builtin_va_list;</div><div>typedef struct <anonymous> entry;</div><div><br class="webkit-block-placeholder"></div><div>char f1(entry *e)</div><div>(CompoundStmt 0x8061e0 <t3.c:2:19, col:38></div><div> (ReturnStmt 0x8061d0 <col:21, col:32></div><div> (UnaryOperator 0x8061b0 <col:28, col:32> 'char' prefix '*'</div><div> (ImplicitCast char*</div><div> (MemberExpr 0x806180 <col:29, col:32> 'char [100]' ->name 0x805f00</div><div> (DeclRefExpr 0x806160 <col:29> 'entry *' ParmVar='e' 0x806120))))))</div><div><br class="webkit-block-placeholder"></div><div>Maybe Steve can take a look if he has a chance,</div><div><br class="webkit-block-placeholder"></div><div>-Chris</div></div></div>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></blockquote></div><br></div></div></blockquote></div><br></div></body></html>