home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,982 of 243,242   
   Tim Rentsch to Michael S   
   Re: UB or not UB? was: On Undefined Beha   
   12 Jan 26 12:03:36   
   
   From: tr.17687@z991.linuxsc.com   
      
   Michael S  writes:   
      
   > On Mon, 12 Jan 2026 08:03:31 -0800   
   > Andrey Tarasevich  wrote:   
   >   
   >> On Mon 1/12/2026 6:28 AM, Michael S wrote:   
   >>   
   >>> According to C Standard, access to p->table[4] in foo1() is UB.   
   >>> ...   
   >>> Now the question.   
   >>> What The Standard says about foo2() ? Is there UB in foo2() as   
   >>> well?   
   >>   
   >> Yes, in the same sense as in `foo1`.   
   >>   
   >>> gcc code generator does not think so.   
   >>   
   >> It definitely does.   
      
   Right.   
      
   > Do you have citation from the Standard?   
      
   The short answer is section 6.5.6 paragraph 8.   
      
   There is amplification in Annex J.2, roughly three pages   
   after the start of J.2.  You can search for "an array   
   subscript is out of range", where there is a clarifying   
   example.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca