Giter Site home page Giter Site logo

Comments (4)

ckirsch avatar ckirsch commented on June 10, 2024

@Blazefrost I am surprised it only warns there. Do you have any idea how to avoid that warning?

from selfie.

Blazefrost avatar Blazefrost commented on June 10, 2024

GCC seems to apply an optimization, as indicated by the .constprop function suffix. I don't know whether an older GCC version already performed this optimization, but I assume the GCC team either improved the optimizer or the analyzer, or both.

The function string_copy is called five times:

  • selfie/selfie.c

    Line 5599 in cfb6619

    entry = search_global_symbol_table(string_copy("_bump"), VARIABLE);
  • selfie/selfie.c

    Line 5637 in cfb6619

    entry = get_scoped_symbol_table_entry(string_copy("main"), PROCEDURE);
  • selfie/selfie.c

    Line 5719 in cfb6619

    create_symbol_table_entry(GLOBAL_TABLE, string_copy("main"), 0, PROCEDURE, UINT64_T, 0, 0);
  • selfie/selfie.c

    Line 7258 in cfb6619

    create_symbol_table_entry(GLOBAL_TABLE, string_copy("_bump"), 1, VARIABLE, UINT64_T, 0, -data_size);
  • selfie/selfie.c

    Line 7263 in cfb6619

    entry = search_global_symbol_table(string_copy("_bump"), VARIABLE);

So the function is only called with "main" and "_bump" strings which seems to match with the error messages (char[5] and char[6], including the string terminator), and indeed, the function referenced by the warning messages,load_character, casts and dereferences these strings as uint64_t, even though the memory the pointer points to is smaller than an uint64_t.

An easy workaround for now would be to just disable the warning using -Wno-array-bounds

from selfie.

ckirsch avatar ckirsch commented on June 10, 2024

@Blazefrost I just committed a fix: 6c31681...fb7c254 Could you please check if that avoids the warnings?

from selfie.

Blazefrost avatar Blazefrost commented on June 10, 2024

Yes, commit fb7c254 fixed the warnings for me. 👍

from selfie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.