GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    aks (sqx@mastodon.social)'s status on Sunday, 10-Nov-2024 06:54:13 JST aks aks

    @vampiress I stubbed my toe on a text book variant of this very recently where I simply had to duplicate the top stack element, like:

    stack[stack_height++] = stack[stack_height-1];

    The RHS was "hidden" behind a function call which made it slightly harder to see straight away. I didn't see the bug until I tried compiling it on clang instead of gcc.

    So.. I'm half-seriously looking into Ada now :-) (also because it's not the only recent disappointment I've had with C)

    In conversation about 8 months ago from mastodon.social permalink

    Attachments

    1. Domain not in remote thumbnail source whitelist: gcc.so
      Galayr Consultancy
      from galayr
    • Embed this notice
      pinskia (pinskia@hachyderm.io)'s status on Sunday, 10-Nov-2024 06:54:12 JST pinskia pinskia
      in reply to

      @sqx @vampiress At least GCC does warn:
      <source>: In function 'f':
      <source>:3:21: warning: operation on 'stack_height' may be undefined [-Wsequence-point]
      3 | stack[stack_height++] = stack[stack_height-1];
      | ~~~~~~~~~~~~^~

      clang warns too.
      I almost always use `-W -Wall` (-W is an alias for -Wextra) when compiling which is why I see these warnings.
      Also there is a paper for C to make it well defined and not unspecified.

      In conversation about 8 months ago permalink
    • Embed this notice
      pinskia (pinskia@hachyderm.io)'s status on Sunday, 10-Nov-2024 07:25:30 JST pinskia pinskia
      in reply to

      @sqx yes that is definitely much harder to warn about. I can't find the paper which is written up to change the standard. The paper is also requesting it be considered a defect against older versions of the standard. Really I wish this was not unspecified but since it is GCC tries to takes advantages of it. Newer C++ makes some things not unspecified but still leaves out some stuff like arguments evaluation.

      In conversation about 8 months ago permalink
    • Embed this notice
      aks (sqx@mastodon.social)'s status on Sunday, 10-Nov-2024 07:25:31 JST aks aks
      in reply to
      • pinskia

      @pinskia (NOTE: I untagged Elissa because she has since deleted the thread). I get the same result with that exact code, but in my case the RHS was inside a function call, and then both gcc and clang are silent about it, even with -fsanitize=undefined. So the code in the image doesn't warn me in gcc/clang, but if you change #if 0 to #if 1 it does

      In conversation about 8 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/113/455/250/299/185/296/original/5602ee30c61e21e7.png

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.